Sunday, August 21, 2016

CCIE 400-101: Layer 2 Technologies - IGMP snooping, IGMP querier, IGMP filter, IGMP proxy

IGMP snooping


  • IGMP snooping examines IGMP protocol messages within a VLAN to discover which interfaces are connected to devices interested in receiving multicast traffic.
  • By default, a switch would flood a multicast frame throughout the VLAN, just like it would do for a broadcast or unknown unicast frame. The reason is because a switch would never find a multicast MAC address in its CAM table because it is never used a source address.
  • The term snooping is used because Layer 3 control plane packets are intercepted and influence Layer 2 forwarding decisions.
  • When IGMP snooping is enabled, the switch monitors IGMP packets between receivers and multicast routers and uses the content of the packets to build a multicast cache table—a database of multicast groups and the interfaces that are connected to members of the groups. 
  • When the switch receives multicast packets, it uses the cache table to selectively forward the traffic to only the interfaces that are connected to members of the appropriate multicast groups.


Forwarding Interfaces and Rules


  • Two types of interfaces:
    • Multicast-router interfaces—These interfaces lead toward multicast routers or IGMP queriers.
    • Group-member interfaces—These interfaces lead toward hosts that are members of multicast groups.
  • The switch learns about these interfaces by monitoring IGMP traffic.
  • If an interface receives IGMP queries or PIM updates, the switch adds the interface to its multicast forwarding table as a multicast-router interface.
  • If an interface receives membership reports for a multicast group, the switch adds the interface to its multicast forwarding table as a group-member interface.
  • The multicast-router interface or a group-member interface can also be statically configured.
  • Note: For a switch to learn multicast-router interfaces and group-member interfaces, an IGMP querier must exist in the network. This is often a multicast router, but if there is no multicast router on the local network, the switch itself can be configured to be an IGMP querier.
  • Multicast traffic received on a switch interface in a VLAN on which IGMP snooping is enabled is forwarded according to specific rules.
  • IGMP traffic is forwarded as follows:
    • IGMP general queries received on a multicast-router interface are forwarded to all other interfaces in the VLAN.
    • IGMP group-specific queries received on a multicast-router interface are forwarded to only those interfaces in the VLAN that are members of the group.
    • IGMP reports received on a host interface are forwarded to multicast-router interfaces in the same VLAN, but not to the other host interfaces in the VLAN.
  • Multicast traffic that is not IGMP traffic is forwarded as follows:
    • A multicast packet with a destination address of 224.0.0.0/24 is flooded to all other interfaces on the VLAN.
    • An unregistered multicast packet—that is, a packet for a group that has no current members—is forwarded to all multicast-router interfaces in the VLAN.
    • A registered multicast packet is forwarded only to those host interfaces in the VLAN that are members of the multicast group and to all multicast-router interfaces in the VLAN.


IGMP querier


  • When there is no multicast router in the VLAN to originate the queries, you must configure an IGMP snooping querier to send membership queries.
  • The presence of at least one mrouter port is absolutely essential for the IGMP snooping operation to work across switches.
  • You must have the switches somehow learn or know of an mrouter port.
  • When a network/VLAN does not have a router that can take on the multicast router role and provide the mrouter discovery on the switches, you can turn on the IGMP querier feature. 
  • The feature allows the Layer 2 switch to proxy for a multicast router and send out periodic IGMP queries in that network. 
  • This action causes the switch to consider itself an mrouter port. 
  • The remaining switches in the network simply define their respective mrouter ports as the interface on which they received this IGMP query.


IGMP filter


  • IGMP filtering allows users to configure filters on a switch virtual interface (SVI), a per-port, or a per-port per-VLAN basis to control the propagation of IGMP traffic through the network.
  • IGMP filtering provides the capability to manage IGMP snooping, which in turn controls the forwarding of multicast traffic.
  • When an IGMP packet is received, IGMP filtering uses the filters configured by the user to determine whether the IGMP packet should be discarded or allowed to be processed by IGMP snooping. 
  • With a IGMPv1 or IGMPv2 packet, the entire packet is discarded. 
  • With a IGMPv3 packet, the packet is rewritten to remove message elements that were denied by the filters.
  • Access can be restricted based on the following:
    • Which multicast groups or channels can be joined on a port. Channels are joined by IGMPv3 hosts that specify both the group and the source of the multicast traffic (ip igmp snooping access-group acl [vlan vlan_id]).
    • Maximum number of groups or channels allowed on a specific port or interface (regardless of the number of hosts requesting service) (ip igmp snooping limit n [except acl] [vlan vlan_id]).
    • IGMP protocol versions (for example, disallow all IGMPv1 messages) (ip igmp snooping minimum-version 2 | 3).


IGMP proxy


  • In certain topologies, it is not necessary to run a multicast routing protocol (like PIM). It is sufficient for a device to learn and proxy group membership information and simply forward multicast packets based upon that information.
  • A proxy device performing IGMP forwarding has a single upstream interface and one or more downstream interfaces.  
  • These designations are explicitly configured; there is no protocol to determine what type each interface is.  
  • It performs the router portion of the IGMP on its downstream interfaces, and the host portion of IGMP on its upstream interface.  



References

Multicast in Campus Network: CGMP and IGMP Snooping
IGMP Snooping Overview
IGMP Filtering
IGMP Proxying


Sunday, July 31, 2016

CCIE 400-101: Layer 2 Technologies - IGMPv1, IGMPv2, IGMPv3

IP Multicast Basics


  • Simplified: unicast = one-to-one, broadcast = one-to-all, multicast = one-to-many (or many-to-many).
  • Multicast is simultaneously delivering a single stream of information to multiple receivers.
  • The receivers indicate their interest in participating in a multicast group by sending an IGMP host report (join message).
  • A multicast group is an arbitrary group of receivers that want to receive a particular data stream. This group has no physical or geographical boundaries - the hosts can be located anywhere.
  • The routers use PIM to dynamically create a multicast distribution tree. The multicast stream will then be delivered only to the network segments that are in the path between the source and the receivers.
  • IPv4 class D address space is used for IP multicast. The range is 224.0.0.0 through 239.255.255.255.
  • Some addresses in the 224.0.0.0/24 range have been reserved for network protocols on the local network segment. Packets to these addresses are typically sent with a TTL of 1 and are not forwarded by a router. For example, 224.0.0.1 is the 'all systems on this subnet' multicast address, and 224.0.0.2 is the 'all routers on this subnet' multicast address.
  • Addresses in the 239.0.0.0/8 range are limited scope addresses and constrained to a local multicast applications that will not be forwarded outside the domain. Routers typically use filters to prevent multicast traffic in this address range from flowing outside the AS.
  • There are also other reserved multicast addresses, which are not discussed here.


Layer 2 Multicast Addresses


  • IP multicast address maps directly to a MAC address.
  • NICs can receive packets destined to many different MAC addresses -  their own unicast, broadcast, and a range of multicast addresses.
  • In the 802.3 standard, bit 0 of the first octet is used to indicate a broadcast or multicast frame.
  • The range 0100.5e00.0000 through 0100.5e7f.ffff is used for MAC addresses for IP multicast.
  • The mapping places the lower 23 bits in the IP multicast group address into the 23 bits in the MAC address.
  • Because the upper five bits of the IP multicast address are dropped in this mapping, the resulting address is not unique. In fact, 32 (2^5) different multicast IP addresses map to the same MAC address.
  • This has to be considered when assigning IP multicast addresses.
  • For example, 224.1.1.1 and 225.1.1.1 map to the same multicast MAC address.



Internet Group Management Protocol (IGMP)


  • IGMP is used to dynamically register individual hosts in a multicast group on a particular LAN. 
  • Hosts identify group memberships by sending IGMP messages to their local multicast router.
  • IGMPv2 improves over IGMPv1 by adding the ability for a host to signal desire to leave a multicast group and IGMPv3 improves over IGMPv2 mainly by adding the ability to listen to multicast originating from a set of source IP addresses only. 
  • Note: By default, enabling a PIM on an interface enables IGMPv2 on that device.


IGMP Version 1


  • Only the following two types of IGMP messages exist:
    • Membership query
    • Membership report
  • Hosts send out IGMP membership reports corresponding to a particular multicast group to indicate that they are interested in joining that group.
  • IGMPv1 has no special mechanism by which the hosts can leave the group.
  • If the hosts are no longer interested in receiving multicast packets for a particular group, they simply do not reply to the IGMP query packets sent from the router. 
  • The router periodically sends out an IGMP membership query to verify that at least one host on the subnet is still interested in receiving traffic directed to that group. 
  • When there is no reply to three consecutive IGMP membership queries, the router times out the group and stops forwarding traffic directed toward that group. 
  • If the host later wants to receive multicast packets after the timeout period, the host simply sends a new IGMP join to the router, and the router begins to forward the multicast packet again.
  • If more than one multicast receiver exists for the same multicast group, only one of these hosts sends an IGMP report message; the other hosts suppress their report messages. 
  • In IGMPv1, there is no election of an IGMP querier. If more than one router on the segment exists, all the routers send periodic IGMP queries. 


IGMP Version 2


  • IGMPv1 has been superceded by IGMPv2 (backward compatible with IGMPv1).
  • Four types of IGMP messages exist:
    • Membership query
    • Version 1 membership report
    • Version 2 membership report
    • Leave group
  • IGMPv2 works basically the same way as IGMPv1. The main difference is that there is a leave group message. With this message, the hosts can actively communicate to the local multicast router that they intend to leave the group.
  • The router still sends out a group-specific query and determines if any remaining hosts are interested in receiving the traffic.
  • If there are no replies, the router times out the group and stops forwarding the traffic. 
  • The leave group message guarantees that unwanted and unnecessary traffic can be stopped much sooner.


IGMP Version 3


  • IGMPv3 is the next step in the evolution of IGMP.
  • IGMPv3 adds support for "source filtering," which enables a multicast receiver host to signal to a router the groups from which it wants to receive multicast traffic, and from which sources this traffic is expected.
  • The following types of IGMP messages exist:
    • Version 3 membership query
    • Version 3 membership report
  • Receivers signal membership to a multicast host group in the following two modes:
    • INCLUDE mode—In this mode, the receiver announces membership to a host group and provides a list of source addresses (the INCLUDE list) from which it wants to receive traffic.
    • EXCLUDE mode—In this mode, the receiver announces membership to a multicast group and provides a list of source addresses (the EXCLUDE list) from which it does not want to receive traffic. The host will receive traffic only from sources whose IP addresses are not listed in the EXCLUDE list. To receive traffic from all sources, which is the behavior of IGMPv2, a host uses EXCLUDE mode membership with an empty EXCLUDE list.
  • In IGMPv3, hosts send their membership reports to 224.0.0.22; all IGMPv3 routers, therefore, must listen to this address. Hosts, however, do not listen or respond to 224.0.0.22; they only send their reports to that address. 
  • In addition, in IGMPv3, there is no membership report suppression because IGMPv3 hosts do not listen to the reports sent by other hosts. Therefore, when a general query is sent out, all hosts on the wire respond.


IGMP Join Process


  • When a host wants to join a multicast group, the host sends one or more unsolicited membership reports for the multicast group it wants to join. The IGMP join process is the same for IGMPv1 and IGMPv2 hosts.
  • In IGMPv3, the join process for hosts proceeds as follows:
    • When a hosts wants to join a group, it sends an IGMPv3 membership report to 224.0.0.22 with an empty EXCLUDE list.
    • When a host wants to join a specific channel, it sends an IGMPv3 membership report to 224.0.0.22 with the address of the specific source included in the INCLUDE list.
    • When a host wants to join a group excluding particular sources, it sends an IGMPv3 membership report to 224.0.0.22 excluding those sources in the EXCLUDE list.


IGMP Leave Process


IGMPv1 Leave Process


  • There is no leave-group message in IGMPv1 to notify the router that a host no longer wants to receive multicast traffic for a specific group.
  • The host simply stops processing traffic for the multicast group and ceases responding to IGMP queries with IGMP membership reports for the group.
  • The only way IGMP routers know that there are no active receivers for a particular multicast group is when they stop receiving membership reports. 
  • A countdown timer is used to facilitate this process. When a membership report is received, the timer is reset. This timeout interval is typically three times the query interval (3 minutes).
  • This timeout interval means that the router may continue to forward multicast traffic onto the subnet for up to 3 minutes after all hosts have left the multicast group.


IGMPv2 Leave Process


  • IGMPv2 incorporates a leave-group message to notify the router to stop receiving multicast traffic for a specific group.
  • When an IGMPv2 host leaves a multicast group, if it was the last host to respond to a query with a membership report for that group, it sends a leave-group message to the all-devices multicast group (224.0.0.2).


IGMPv3 Leave Process


  • IGMPv3 enhances the leave process by introducing the capability for a host to stop receiving traffic from a particular group, source, or channel in IGMP by including or excluding sources, groups, or channels in IGMPv3 membership reports.



References

IP Multicast Technology Overview
IP Multicast: IGMP Configuration Guide, Cisco IOS Release 15M&T

Sunday, July 24, 2016

CCIE 400-101: Layer 2 Technologies - STP Dispute, STP Bridge Assurance

STP Dispute


  • The software checks the consistency of the port role and state in the received BPDUs to detect unidirectional link failures that could cause a loop.
  • When a designated port detects a conflict (receives an inferior BPDU), it keeps its role, but reverts to a discarding state.
  • Rapid PVST+ (802.1w) and MST BPDUs include the role and state of the sending port. With this information, switch A (root) can detect that switch B does not react to its superior BPDUs and that switch B is the designated, not root port. As a result, switch A blocks the port.
  • The block is shown as an STP dispute.


STP Bridge Assurance


  • Bridge Assurance is enabled by default and can only be disabled globally (available on Cisco IOS Release 12.2(33)SXI and later).
  • Only enabled on STP network ports that are point-to-point links.
  • Both ends of the link must have Bridge Assurance enabled.
  • If the device on one side of the link has Bridge Assurance enabled and the device on the other side either does not support Bridge Assurance or does not have this feature enabled, the connecting port is blocked.
  • With Bridge Assurance enabled, BPDUs are sent out on all operational network ports, including alternate and backup ports, for each hello time period.
  • If the port does not receive a BPDU for a specified period, the port moves into an inconsistent state (blocking). and is not used in the root port calculation.
  • Once that port receives a BPDU, it resumes the normal spanning tree transitions.
  • Recommended to enable Bridge Assurance throughout the network.

References

Spanning-Tree Dispute Mechanism
Understanding Bridge Assurance

Saturday, July 23, 2016

CCIE 400-101: Layer 2 Technologies - Loop Guard, Root Guard

Loop Guard


  • When a redundant port no longer receives BPDUs, the STP conceives that the topology is loop free. Eventually, the blocking port (alternate or backup port) becomes designated and moves to a forwarding state. This situation creates a loop.
  • The loop guard feature makes additional checks. 
  • If BPDUs are not received on a non-designated port, and loop guard is enabled, that port is moved into the STP loop-inconsistent blocking state, instead of the listening / learning / forwarding state. 
  • Once the BPDU is received on a port in a loop-inconsistent STP state, the port transitions into another STP state. According to the received BPDU, this means that the recovery is automatic and intervention is not necessary.
  • Loop guard must be enabled on the non-designated ports (more precisely, on root and alternate ports) for all possible combinations of active topologies.
  • Loop guard can only be enabled on point-to-point links.
  • Loop guard does not work with PortFast or root guard.
  • Loop guard and UDLD functionality overlap.
  • Both protect against STP failures caused by unidirectional links.
  • The highest level of protection is provided when both UDLD and loop guard are enabled.
  • Enable with the spanning-tree guard loop command.


Root Guard


  • The administrator can set the root bridge priority to 0 in an effort to secure the root bridge position. But there is no guarantee against a bridge with a priority of 0 and a lower MAC address.
  • The root guard feature provides a way to enforce the root bridge placement in the network.
  • The root guard ensures that the port on which root guard is enabled is the designated port.
  • If the bridge receives superior BPDUs on a root guard-enabled port, root guard moves this port to a root-inconsistent STP state, which is effectively equal to a listening state. No traffic is forwarded across this port.
  • Root guard is mutually exclusive with loop guard.
  • Root guard is used on designated ports, and it does not allow the port to become non-designated. Loop guard works on non-desginated ports and does not allow the port to become designated through the expiration of MaxAge.
  • When loop guard is configured on the port, it disables root guard configured on the same port.
  • You must enable root guard (spanning-tree guard root) on all ports where the root bridge should not appear.


References

STP Enhancements Using Loop Guard and BPDU Skew Detection Features
STP Root Guard Enhancement

Thursday, July 21, 2016

CCIE 400-101: Layer 2 Technologies - PortFast, BPDU Guard, BPDU Filter

PortFast


  • The PortFast feature was originally developed to overcome a situation where a PC was unable to obtain a DHCP address due to the port failing to transition into the forwarding state in time. 
  • This results from STP going through the listening and learning states, which would normally take 30 seconds. 
  • The PortFast feature allows the port to enter the forwarding state immediately, bypassing the listening and learning states.
  • Should be configured only on edge ports connecting to end devices.
  • A PortFast enabled port will continue to transmit BPDUs and participate in STP.
  • If the port receives BPDUs, the PortFast feature is disabled.
  • Two ways to enable PortFast: globally (spanning-tree portfast default) or per interface (spanning-tree portfast).
  • Both commands enable PortFast on operational access ports.
  • To enable PortFast on both access and trunk ports, use the spanning-tree portfast trunk command.


BPDU Guard


  • BPDU guard prevents a port from receiving BPDUs.
  • If the port still receives a BPDU, it is put in the error-disabled state.
  • Much like the PortFast feature, BPDU Guard has two configuration options: globally (spanning-tree portfast bpduguard default) and per interface (spanning-tree bpduguard enable).
  • If configured globally, BPDU Guard is dependent on the operational PortFast state.
  • The per interface configuration unconditionally enables BPDU Guard on the port, independent of PortFast or access/trunk mode.
  • There are two ways to recover an err-disabled port, either by manually re-enabling with shutdown and no shutdown commands or by configuring automatic err-disable recovery with errdisable recovery cause bpduguard. 


BPDU Filter


  • BPDU Filter prevents specified ports from sending or receiving BPDUs.
  • Again, there are two methods to configure this feature: globally (spanning-tree portfast bpdufilter default) and per interface (spanning-tree bpdufilter enable). 
  • The interface configuration filters both incoming and outgoing BPDUs unconditionally – independent of the operational PortFast state or access/trunk mode. This is effectively the equivalent of turning off STP.
  • The global BPDU Filter is enabled on interfaces in operational PortFast state. 
  • In global mode, the switch does not filter incoming BPDUs, but most (though not all) outgoing BPDUs are filtered. When a port comes up, 11 BPDUs are sent out. 
  • If BPDUs are received, the PortFast and BPDU Filter features are disabled.


Summary


  • PortFast immediately moves the port into the forwarding state, bypassing listening and learning states.
  • A PortFast enabled port will continue to transmit BPDUs.
  • If a BPDU is received, PortFast is disabled.
  • The switch never generates a TCN when a PortFast enabled port goes up or down.
  • There is a difference between administrative and operational state.
  • The spanning-tree portfast trunk command enables PortFast on both access and trunk ports.
  • BPDU Guard and BPDU Filter global mode is dependent on operational PortFast.
  • BPDU Guard and BPDU Filter interface mode is unconditional.
  • Misconfigured BPDU Filter is much more dangerous than misconfigured PortFast, yet IOS does not generate a warning message about that.
  • PortFast can create a temporary loop of max. 2 seconds (default Hello interval) until the next BPDU is received and PortFast is disabled. BPDU Filter can create a permanent loop, because all BPDUs are ignored.
  • Remember the operation of STP - when BPDUs are sent and not sent.



References

Advanced STP Features: PortFast, BPDU Guard, and BPDU Filter

Friday, February 19, 2016

CCIE 400-101: Layer 2 Technologies - Switch Priority, Port Priority, Path Cost, STP Timers

Switch Priority


  • The IEEE 802.1D standard requires that each switch has an unique bridge identifier (BID),  which controls the selection of the root switch.
  • For PVST+/RPvST+, the same switch must have different bridge IDs for each configured VLAN.
  • Each VLAN on the switch has a unique 8-byte bridge ID. 
  • The 2 most-significant bytes are used for the switch priority, and the remaining 6 bytes are derived from the switch MAC address.
  • The switch supports the IEEE 802.1t spanning-tree extensions, and some of the bits previously used for the switch priority are now used as the VLAN identifier. 
  • The result is that fewer MAC addresses are reserved for the switch, and a larger range of VLAN  IDs can be supported, all while maintaining the uniqueness of the BID.
  • The 2 bytes previously used for the switch priority are reallocated into a 4-bit priority value and a 12-bit extended system ID value equal to the VLAN ID.


  • The default switch priority is 32768.
  • The switch priority can be manually configured with the spanning-tree vlan <vlan-id> priority <0-61440> command.
  • The priority can be changed only in increments of 4096. 
  • Valid priority values are 0, 4096, 8192, 12288, 16384, 20480, 24576, 28672, 32768, 36864, 
  • 40960, 45056, 49152, 53248, 57344, and 61440. All other values are rejected.
  • There are also two indirect ways to affect the switch priority: spanning-tree vlan <vlan-id> root primary and spanning-tree vlan <vlan-id> root secondary.
  • The primary keyword sets the switch priority to 24576 if that priority allows the switch to become the root. Otherwise, this command sets the switch priority to 4096 lower than the current root.
  • The secondary keyword always sets the switch priority to 28672.
  • This primary/secondary logic is only applied at the time of command execution. The switch priority does not dynamically change if another switch later advertises a better priority.


Port Priority


  • Much like the bridge ID, STP also assigns a unique port ID for each interface.
  • The port ID is a 2-byte field, divided into a 4-bit priority value and a 12-bit interface identifier.
  • The interface identifier is fixed.
  • The default port priority value is 128.
  • The port priority can be manually reconfigured with the spanning-tree vlan <vlan-id> port-priority <0-224>, in increments of 32.
  • The priority values are 0, 32, 64, 96, 128, 160, 192, and 224. All other values are rejected.
  • IMPORTANT: The switch looks at the information in the received BPDU to decide which port to block - not what is locally configured on the switch.
  • This can be confusing when show spanning-tree vlan <vlan-id> output displays seemingly conflicting information.


Cat2#sh spanning-tree vlan 1

VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    24577
             Address     0018.1820.2700
             Cost        19
             Port        24 (FastEthernet0/24)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     000b.46e2.6980
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Fa0/23              Altn BLK 19        128.23   P2p
Fa0/24              Root FWD 19        128.24   P2p


  • From the above output, you might mistakenly conclude that Fa0/23 should be Root Port and Fa0/24 should be Alternate Port because of the lower port ID (Fa0/23 - 128.23 < Fa0/24 - 128.24). However, this is what is locally configured on the switch and does not affect the STP port blocking process.
  • To see what the switch is learning from its upstream neighbor, you must look at more detailed output.


Cat2#show spanning-tree vlan 1 int fa0/23 detail
 Port 23 (FastEthernet0/23) of VLAN0001 is alternate blocking
   Port path cost 19, Port priority 128, Port Identifier 128.23.
   Designated root has priority 24577, address 0018.1820.2700
   Designated bridge has priority 24577, address 0018.1820.2700
   Designated port id is 128.25, designated path cost 0
   Timers: message age 1, forward delay 0, hold 0
   Number of transitions to forwarding state: 1
   Link type is point-to-point by default
   BPDU: sent 1938, received 694

Cat2#show spanning-tree vlan 1 int fa0/24 detail
 Port 24 (FastEthernet0/24) of VLAN0001 is root forwarding
   Port path cost 19, Port priority 128, Port Identifier 128.24.
   Designated root has priority 24577, address 0018.1820.2700
   Designated bridge has priority 24577, address 0018.1820.2700
   Designated port id is 64.26, designated path cost 0
   Timers: message age 2, forward delay 0, hold 0
   Number of transitions to forwarding state: 2
   Link type is point-to-point by default
   BPDU: sent 1993, received 697


  • The highlighted information signifies why Fa0/24 is forwarding and Fa0/23 is not (received port ID 64.26 < 128.25).


Path Cost


  • Path cost is simply the cost to reach the root switch.
  • Each interface has a default cost assigned to it based on bandwidth (for example, 100 Mbps = 19).
  • There are two cost assignment methods: the short method (spanning-tree pathcost method short -  the default) and the long method (spanning-tree pathcost method long).
  • The short method uses a 16-bit format that yields values from 1-65535. 
  • The long method uses a 32-bit format that yields values from 1-200,000,000. 


  • Why is the maximum 200,000,000 when a 32-bit number can clearly have a higher value?
    • Limiting the range of the Path Cost parameter to 1-200,000,000 ensures that the accumulated Path Cost cannot exceed 32 bits over a concatenation of 20 hops.
  • The switch calculates its port cost by adding its interface cost to the root path cost in the  received BPDU. Example: a switch located two 100 Mbps hops away from the root bridge would  have a path cost of 38 (19 + 19 = 38).
  • The cost value can be manually altered with the spanning-tree vlan <vlan-id> cost <value> command.


STP Timers


  • There are several STP timers, three of which are commonly known and play a key role in STP operation:
    • Hello: The hello time is the time between each BPDU that is sent on a port. This time is equal to 2 seconds (sec) by default, but you can tune the time to be between 1 and 10 sec.
    • Forward Delay: The forward delay is the time that is spent in the listening and learning state. This time is equal to 15 sec by default, but you can tune the time to be between 4 and 30 sec.
    • Max Age: The max age timer controls the maximum length of time that a switchport saves its configuration BPDU information. This time is 20 sec by default, but you can tune the time to be between 6 and 40 sec.
  • Each configuration BPDU contains these three parameters. 
  • Each configuration BPDU also contains another time-related parameter that is known as the Message Age. 
  • The Message Age contains the length of time that has passed since the root bridge initially originated the BPDU. 
  • The root bridge sends all its BPDUs with a message age value of 0, and all subsequent switches add 1 to this value. 
  • Effectively, this value contains the information on how far you are from the root bridge when you receive a BPDU.
  • In addition to the timers, IEEE 802.1D defines other parameters related to STP (like the STP domain diameter). See: Understanding and Tuning Spanning Tree Protocol Timers.


References

CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1
Understanding Spanning Tree Port Priority
Configuring STP
Spanning Tree Port Costs
Understanding and Tuning Spanning Tree Protocol Timers

Monday, February 8, 2016

CCIE 400-101: Layer 2 Technologies - STP Concepts

STP Versions

  • The first IEEE-standardized STP, also often called the “legacy” STP, was originally described in 802.1D. 
  • The Rapid STP (RSTP) was standardized in 802.1w, while Multiple STP (MSTP) was covered in 802.1s. 
  • 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. 
  • Therefore, RSTP is covered in 802.1D while MSTP is covered in 802.1Q, and legacy STP has been dropped.

STP Concepts

  • STP uses special messaging between switches to establish a loop-free topology by logically blocking redundant links. 
  • STP protocol messages are called Bridge Protocol Data Units (BPDUs). 
  • STP operation is based on the ability to compare any two arbitrary Configuration BPDUs and determine which one of them is better, or superior.
  • For a detailed breakdown of a BPDU, see: BPDU Format and STP Timers. 
  • The determine the superior BPDU, 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)
    • Sender Bridge ID (SBID)
    • Sender Port ID (SPID)
    • Receiver Port ID (RPID; not included in the BPDU, evaluated locally; very uncommon) 
  • Only Configuration BPDUs are compared.
  • Each port in STP stores (that is, remembers) the superior BPDU it has either sent or received. 
  • 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. 
  • To determine which ports forward and block, STP follows a three-step process:
    1. Elect the root switch: the switch with the lowest bridge ID.
    2. Determine root port on each switch: the port on each non-root switch that receives the best BPDU.
    3. Determine the designated port for each segment: the switch that sends the superior BPDU on the segment.

Determining the Root Port

  • Each non-root switch chooses exactly one port as its Root Port, i.e. the port that receives the best resulting BPDU. 
  • This means that the switch adds the port's cost to the advertised Root Path Cost value, yielding a resulting BPDU.
  • BPDUs received on the Root Port of a non-root switch are forwarded out its designated ports after updating the Root Path Cost, Sender Bridge ID, Send Port ID, and MessageAge fields accordingly. 
  • BPDUs received on other ports of a non-root switch are processed but they are not forwarded.
  • 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 segment, but the values can be different.
  • 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.


Determining the Designated Port

  • Designated switch = switch forwarding BPDUs on a LAN segment. 
  • Designated Port = the port that the designated switch uses to forward frames onto the segment. 
  • All other ports are neither Root or Designated will be moved to Blocking state (Non-Designated ports). 
  • The become the Designated Port, the switch must send superior BPDUs on the segment.
  • The tiebreakers during Designated Port selection are the same as before (how to find the superior BPDU).
  • Neither Root Ports nor Blocking ports send BPDUs. 

Summary

  • The root switch is the switch that has the lowest Bridge ID in the topology. 
  • On each non-root switch, a Root Port is the port receiving the best (that is, superior) resulting BPDUs from all received BPDUs on all ports. 
  • On each connected segment, a Designated Port is the port sending the best (that is, superior) BPDUs on the segment. 
  • 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.
  • 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.

About STP Timers

  • The MessageAge field is an estimation of the BPDU’s age since it was originated by the root bridge. 
  • At the root bridge, the MessageAge 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 non-root switch are not used and would become effective only if the switch itself became the root switch. 

References 

CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1