
- •Warning and Disclaimer
- •Feedback Information
- •Trademark Acknowledgments
- •About the Author
- •About the Technical Reviewers
- •Dedication
- •Acknowledgments
- •Contents at a Glance
- •Contents
- •Icons Used in This Book
- •Command Syntax Conventions
- •Cisco’s Motivation: Certifying Partners
- •Format of the CCNA Exams
- •What’s on the CCNA Exams
- •ICND Exam Topics
- •Cross-Reference Between Exam Topics and Book Parts
- •CCNA Exam Topics
- •INTRO and ICND Course Outlines
- •Objectives and Methods
- •Book Features
- •How This Book Is Organized
- •Part I: LAN Switching
- •Part II: TCP/IP
- •Part III: Wide-Area Networks
- •Part IV: Network Security
- •Part V: Final Preparation
- •Part VI: Appendixes
- •How to Use These Books to Prepare for the CCNA Exam
- •For More Information
- •Part I: LAN Switching
- •“Do I Know This Already?” Quiz
- •Foundation Topics
- •Brief Review of LAN Switching
- •The Forward-Versus-Filter Decision
- •How Switches Learn MAC Addresses
- •Forwarding Unknown Unicasts and Broadcasts
- •LAN Switch Logic Summary
- •Basic Switch Operation
- •Foundation Summary
- •Spanning Tree Protocol
- •“Do I Know This Already?” Quiz
- •Foundation Topics
- •Spanning Tree Protocol
- •What IEEE 802.1d Spanning Tree Does
- •How Spanning Tree Works
- •Electing the Root and Discovering Root Ports and Designated Ports
- •Reacting to Changes in the Network
- •Spanning Tree Protocol Summary
- •Optional STP Features
- •EtherChannel
- •PortFast
- •Rapid Spanning Tree (IEEE 802.1w)
- •RSTP Link and Edge Types
- •RSTP Port States
- •RSTP Port Roles
- •RSTP Convergence
- •Edge-Type Behavior and PortFast
- •Link-Type Shared
- •Link-Type Point-to-Point
- •An Example of Speedy RSTP Convergence
- •Basic STP show Commands
- •Changing STP Port Costs and Bridge Priority
- •Foundation Summary
- •Foundation Summary
- •Virtual LANs and Trunking
- •“Do I Know This Already?” Quiz
- •Foundation Topics
- •Review of Virtual LAN Concepts
- •Trunking with ISL and 802.1Q
- •ISL and 802.1Q Compared
- •VLAN Trunking Protocol (VTP)
- •How VTP Works
- •VTP Pruning
- •Foundation Summary
- •Part II: TCP/IP
- •IP Addressing and Subnetting
- •“Do I Know This Already?” Quiz
- •Foundation Topics
- •IP Addressing Review
- •IP Subnetting
- •Analyzing and Interpreting IP Addresses and Subnets
- •Math Operations Used to Answer Subnetting Questions
- •Converting IP Addresses from Decimal to Binary and Back Again
- •The Boolean AND Operation
- •How Many Hosts and How Many Subnets?
- •What Is the Subnet Number, and What Are the IP Addresses in the Subnet?
- •Finding the Subnet Number
- •Finding the Subnet Broadcast Address
- •Finding the Range of Valid IP Addresses in a Subnet
- •Finding the Answers Without Using Binary
- •Easier Math with Easy Masks
- •Which Subnet Masks Meet the Stated Design Requirements?
- •What Are the Other Subnet Numbers?
- •Foundation Summary
- •“Do I Know This Already?” Quiz
- •Foundation Topics
- •Extended ping Command
- •Distance Vector Concepts
- •Distance Vector Loop-Avoidance Features
- •Route Poisoning
- •Split Horizon
- •Split Horizon with Poison Reverse
- •Hold-Down Timer
- •Triggered (Flash) Updates
- •RIP and IGRP
- •IGRP Metrics
- •Examination of RIP and IGRP debug and show Commands
- •Issues When Multiple Routes to the Same Subnet Exist
- •Administrative Distance
- •Foundation Summary
- •“Do I Know This Already?” Quiz
- •Foundation Topics
- •Link-State Routing Protocol and OSPF Concepts
- •Steady-State Operation
- •Loop Avoidance
- •Scaling OSPF Through Hierarchical Design
- •OSPF Areas
- •Stub Areas
- •Summary: Comparing Link-State and OSPF to Distance Vector Protocols
- •Balanced Hybrid Routing Protocol and EIGRP Concepts
- •EIGRP Loop Avoidance
- •EIGRP Summary
- •Foundation Summary
- •“Do I Know This Already?” Quiz
- •Foundation Topics
- •Route Summarization and Variable-Length Subnet Masks
- •Route Summarization Concepts
- •VLSM
- •Route Summarization Strategies
- •Sample “Best” Summary on Seville
- •Sample “Best” Summary on Yosemite
- •Classless Routing Protocols and Classless Routing
- •Classless and Classful Routing Protocols
- •Autosummarization
- •Classful and Classless Routing
- •Default Routes
- •Classless Routing
- •Foundation Summary
- •Advanced TCP/IP Topics
- •“Do I Know This Already?” Quiz
- •Foundation Topics
- •Scaling the IP Address Space for the Internet
- •CIDR
- •Private Addressing
- •Network Address Translation
- •Static NAT
- •Dynamic NAT
- •Overloading NAT with Port Address Translation (PAT)
- •Translating Overlapping Addresses
- •Miscellaneous TCP/IP Topics
- •Internet Control Message Protocol (ICMP)
- •ICMP Echo Request and Echo Reply
- •Destination Unreachable ICMP Message
- •Time Exceeded ICMP Message
- •Redirect ICMP Message
- •Secondary IP Addressing
- •FTP and TFTP
- •TFTP
- •MTU and Fragmentation
- •Foundation Summary
- •Part III: Wide-Area Networks
- •“Do I Know This Already?” Quiz
- •Foundation Topics
- •Review of WAN Basics
- •Physical Components of Point-to-Point Leased Lines
- •Data-Link Protocols for Point-to-Point Leased Lines
- •HDLC and PPP Compared
- •Looped Link Detection
- •Enhanced Error Detection
- •Authentication Over WAN Links
- •PAP and CHAP Authentication
- •Foundation Summary
- •“Do I Know This Already?” Quiz
- •Foundation Topics
- •ISDN Protocols and Design
- •Typical Uses of ISDN
- •ISDN Channels
- •ISDN Protocols
- •ISDN BRI Function Groups and Reference Points
- •ISDN PRI Function Groups and Reference Points
- •BRI and PRI Encoding and Framing
- •PRI Encoding
- •PRI Framing
- •BRI Framing and Encoding
- •DDR Step 1: Routing Packets Out the Interface to Be Dialed
- •DDR Step 2: Determining the Subset of the Packets That Trigger the Dialing Process
- •DDR Step 3: Dialing (Signaling)
- •DDR Step 4: Determining When the Connection Is Terminated
- •ISDN and DDR show and debug Commands
- •Multilink PPP
- •Foundation Summary
- •Frame Relay
- •“Do I Know This Already?” Quiz
- •Foundation Topics
- •Frame Relay Protocols
- •Frame Relay Standards
- •Virtual Circuits
- •LMI and Encapsulation Types
- •DLCI Addressing Details
- •Network Layer Concerns with Frame Relay
- •Layer 3 Addressing with Frame Relay
- •Frame Relay Layer 3 Addressing: One Subnet Containing All Frame Relay DTEs
- •Frame Relay Layer 3 Addressing: One Subnet Per VC
- •Frame Relay Layer 3 Addressing: Hybrid Approach
- •Broadcast Handling
- •Frame Relay Service Interworking
- •A Fully-Meshed Network with One IP Subnet
- •Frame Relay Address Mapping
- •A Partially-Meshed Network with One IP Subnet Per VC
- •A Partially-Meshed Network with Some Fully-Meshed Parts
- •Foundation Summary
- •Part IV: Network Security
- •IP Access Control List Security
- •“Do I Know This Already?” Quiz
- •Foundation Topics
- •Standard IP Access Control Lists
- •IP Standard ACL Concepts
- •Wildcard Masks
- •Standard IP ACL: Example 2
- •Extended IP Access Control Lists
- •Extended IP ACL Concepts
- •Extended IP Access Lists: Example 1
- •Extended IP Access Lists: Example 2
- •Miscellaneous ACL Topics
- •Named IP Access Lists
- •Controlling Telnet Access with ACLs
- •ACL Implementation Considerations
- •Foundation Summary
- •Part V: Final Preparation
- •Final Preparation
- •Suggestions for Final Preparation
- •Preparing for the Exam Experience
- •Final Lab Scenarios
- •Scenario 1
- •Scenario 1, Part A: Planning
- •Solutions to Scenario 1, Part A: Planning
- •Scenario 2
- •Scenario 2, Part A: Planning
- •Solutions to Scenario 2, Part A: Planning
- •Part VI: Appendixes
- •Glossary
- •Answers to the “Do I Know This Already?” Quizzes and Q&A Questions
- •Chapter 1
- •“Do I Know This Already?” Quiz
- •Chapter 2
- •“Do I Know This Already?” Quiz
- •Chapter 3
- •“Do I Know This Already?” Quiz
- •Chapter 4
- •“Do I Know This Already?” Quiz
- •Chapter 5
- •“Do I Know This Already?” Quiz
- •Chapter 6
- •“Do I Know This Already?” Quiz
- •Chapter 7
- •“Do I Know This Already?” Quiz
- •Chapter 8
- •“Do I Know This Already?” Quiz
- •Chapter 9
- •“Do I Know This Already?” Quiz
- •Chapter 10
- •“Do I Know This Already?” Quiz
- •Chapter 11
- •“Do I Know This Already?” Quiz
- •Chapter 12
- •“Do I Know This Already?” Quiz
- •Using the Simulation Software for the Hands-on Exercises
- •Accessing NetSim from the CD
- •Hands-on Exercises Available with NetSim
- •Scenarios
- •Labs
- •Listing of the Hands-on Exercises
- •How You Should Proceed with NetSim
- •Considerations When Using NetSim
- •Routing Protocol Overview
- •Comparing and Contrasting IP Routing Protocols
- •Routing Through the Internet with the Border Gateway Protocol
- •RIP Version 2
- •The Integrated IS-IS Link State Routing Protocol
- •Summary of Interior Routing Protocols
- •Numbering Ports (Interfaces)

38 Chapter 2: Spanning Tree Protocol
Figure 2-2 Network with Redundant Links and STP After Link Failure
|
Larry |
Archie |
||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
0/26 |
0/26 |
|
||
|
|
|
|
|
SW1 |
|
|
SW2 |
|
0/27 |
|
0/27 |
Forwarding
0/27
0/26
SW3
Bob
How does STP 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 sections answer these questions.
How Spanning Tree Works
The STP algorithm creates a spanning tree of interfaces that forward frames. The tree structure creates a single path to and from each Ethernet segment, just like you can trace a single path in a living, growing tree from the base of the tree to each leaf. STP actually places interfaces in forwarding state or blocking state; if an interface has no specific reason to be in forwarding state, STP places the interface in blocking state.
In other words, STP simply picks which interfaces should forward and which shouldn’t.
STP uses three criteria to choose whether to put an interface in forwarding state:
■STP elects a root bridge. STP puts all interfaces on the root bridge in forwarding state.
■Each nonroot bridge considers one of its ports to have the least administrative cost between itself and the root bridge. STP places this least-root-cost interface, called that bridge’s root port, in forwarding state.

Spanning Tree Protocol 39
■Many bridges can attach to the same Ethernet segment. The bridge with the lowest administrative cost from itself to the root bridge, as compared with the other bridges attached to the same segment, is placed in forwarding state. The lowest-cost bridge on each segment is called the designated bridge, and that bridge’s interface, attached to that segment, is called the designated port.
All other interfaces are placed in blocking state. Table 2-2 summarizes the reasons why STP places a port in forwarding or blocking state.
Table 2-2 |
STP: Reasons for Forwarding or Blocking |
|
|
|
|
|
|
|
Characterization of Port |
STP State |
Description |
|
|
|
|
|
All the root bridge’s ports |
Forwarding |
The root bridge is always the designated |
|
|
|
bridge on all connected segments. |
|
|
|
|
|
Each nonroot bridge’s root port |
Forwarding |
The root port is the port receiving the |
|
|
|
lowest-cost BPDU from the root. |
|
|
|
|
|
Each LAN’s designated port |
Forwarding |
The bridge forwarding the lowest-cost |
|
|
|
BPDU onto the segment is the designated |
|
|
|
bridge for that segment. |
|
|
|
|
|
All other ports |
Blocking |
The port is not used for forwarding |
|
|
|
frames, nor are any frames received on |
|
|
|
these interfaces considered for |
|
|
|
forwarding. |
|
|
|
|
Electing the Root and Discovering Root Ports and Designated Ports
STP begins with each bridge claiming to be the root bridge by sending STP messages. STP defines these messages used to exchange information with other bridges, which are called bridge protocol data units (BPDUs). Each bridge begins by sending a BPDU specifying the following:
■The root bridge’s bridge ID—The bridge ID is the concatenation of the bridge’s priority and a MAC address on that bridge (unless it is explicitly configured as another number).
At the beginning of the root-election process, each bridge claims to be root, so each bridge advertises itself as root using its own bridge ID. For instance, Example 2-1 later in this chapter shows output from a switch with a priority of 32768 and a MAC address 0050.f035.a940, combined to form the bridge ID. The lower the priority, the better chance of being root. The IEEE 802.1d STP specification allows for priorities between 0 and 65,535, inclusive.
■The cost to reach the root from this bridge—At the beginning of the process, each bridge claims to be root, so the value is set to 0, which is this bridge’s cost to reach itself. The lower the cost, the better the path, with the range of costs being between 0 and 65,535, inclusive.

40 Chapter 2: Spanning Tree Protocol
■The bridge ID of the sender of this BPDU—This value is always the bridge ID of the sender of the BPDU, regardless of whether the bridge sending the BPDU is the root.
The bridges elect a root bridge based on the bridge IDs in the BPDUs. The root bridge
is the bridge with the lowest numeric value for the bridge ID. Because the two-part bridge ID starts with the priority value, essentially the bridge with the lowest priority becomes the root. For instance, if one bridge has priority 100, and another bridge has priority 200, the bridge with priority 100 wins, regardless of what MAC address was used to create the bridge ID for each bridge/switch.
If a tie occurs based on priority, the root bridge with the lowest MAC address used in the bridge ID is the root. The MAC addresses used to build the bridge IDs should be unique.
Bridges and switches use one of their own burned-in MAC addresses as their bridge ID, so the bridge IDs are unique, because MAC addresses are supposed to be unique. So if the priorities tie, and one switch uses a MAC address of 0020.0000.0000 as part of the bridge ID, and the other uses 0FFF.FFFF.FFF, the first switch (MAC 0200.0000.0000) becomes the root.
The message used to identify the root, its bridge ID, and cost is called a hello BPDU.
STP elects a root bridge, in a manner not unlike a political election. The process of choosing the root begins with all bridges claiming to be the root by sending hello BPDUs with their bridge IDs and priorities. If a bridge hears of a better candidate, it stops advertising itself as root and starts forwarding the hello sent by the better bridge. It works like a political race in which a candidate gives up and leaves the race: The lesser candidate throws his support behind another candidate. Eventually someone wins, and everyone supports the elected switch—which is where the political race analogy falls apart.
Figure 2-3 outlines part of the process. Imagine that SW1 has advertised itself as root, as have SW2 and SW3. SW2 now believes that SW1 is a better root, but SW1 and SW3 still believe that they each are the best, so they still advertise themselves as root.
Figure 2-3 Root Election Process
Root: SW1
Cost: 0
Root-id 32,768:0200.0000.0001
|
|
|
|
|
|
|
0/26 |
|
|
|
SW1 |
|
|
|
|
|
SW2 |
|
|
|
|
|
|
|
|
|
0/27 |
|
|
Root: SW1 |
|
|
|
|
Root: SW1 |
||||
Cost: 0 |
|
|
|
|
Cost: 100 |
||||
Root-id 32,768:0200.0000.0001 |
|
|
|
|
Root-id 32,768:0200.0000.0001 |
||||
|
|
|
|
0/26 0/27 |
|
|
|
||
Root: SW3 |
|
|
Root: SW3 |
||||||
|
SW3 |
|
|||||||
|
|||||||||
Cost: 0 |
|
|
|
Cost: 0 |
|||||
Root-id 32,768:0200.0000.0003 |
Root-id 32,768:0200.0000.0003 |

Spanning Tree Protocol 41
Two candidates still exist in Figure 2-3—SW1 and SW3. So who wins? Well, from the bridge ID, the lower-priority switch wins; if there is a tie, the lower MAC address wins. As shown in the figure, SW1 has a lower bridge ID (32768:0200.0000.0001), so it wins, and SW3 now also believes that SW1 is the better bridge. Figure 2-4 shows the resulting hello messages sent by the switches.
Figure 2-4 SW1 Wins Election
|
|
|
|
SW1 Is Root |
|
|
|
|||
|
|
|
|
Cost = 0 |
|
|
Cost = 100 |
|||
|
|
|
|
|
|
|
|
|||
|
|
|
F |
RP 0/26 |
|
|
||||
|
|
|
|
|||||||
|
SW1 |
|
||||||||
|
|
SW2 |
||||||||
|
F |
|
|
0/27 |
|
|||||
SW1 Is Root |
|
|
|
SW1 Is Root |
||||||
Cost = 0 |
|
|
|
|||||||
|
|
|
Cost = 100 |
|||||||
|
|
|
|
|
|
|
|
|
||
|
|
|
|
RP |
|
|
|
|
|
|
0/26 |
0/27 |
|
|
|
||||||
|
Cost = 150 |
|
|
SW1 Is Root |
||||||
|
|
|
|
|
|
|
|
|||
|
|
|
|
|
SW3 |
|
||||
|
|
|
|
|
|
Cost = 150 |
||||
|
|
|
|
|
|
|
|
SW1’s interfaces are placed in forwarding state because SW1 won the election. All interfaces on the root switch forward. But what about SW2’s and SW3’s interfaces? Well, the second reason that STP places an interface in forwarding state is if it is the root port on that switch. Each switch has one root port, which is the port receiving the least-cost BPDU from the root. In Figure 2-4, SW2’s best cost is seen in the hello entering its port 0/26. Likewise, SW3’s best cost is seen entering its 0/26 port. Therefore, the figure places “RP” beside each of those ports. SW2 and SW3 place those ports in forwarding state.
The final reason that STP places interfaces in forwarding state is if they advertise the lowestcost hello onto a LAN segment—in other words, if the bridge becomes the designated bridge on a segment. In Figure 2-4, both SW2 and SW3 forward hello messages onto the link between them. The cost is calculated by adding the cost in the received hello (0 in this case) to the cost of the interface on which the hello was received. So SW2 adds cost 100 to 0, and
SW3 adds 150 to 0. (The costs of those interfaces are listed in Figure 2-4.) The costs can be configured, or they can default. So, because SW2 advertises the lower-cost hello, SW2’s 0/27 port is the designated port on the LAN segment between SW2 and SW3. SW2 places its port 0/27 in forwarding state because it is the designated port on that segment. (If the costs were the same, the lower bridge ID of the switch sending the BPDUs to the segment would become the designated bridge. In this case, SW2 would win, with bridge ID 32768:0200.0000.0002 versus SW3’s 32768:0200.0000.0003.)