Address Learning – Dynamically learns MAC addresses by reading the source MAC address of each arriving frame. If an address is not in the current MAC address table, and there is enough space to store it, the address and the inbound port are stored.
Forward/Filter – Compares the destination MAC address in an arriving frame to the MAC address table. If the address is in the table, only forwards the frame out the port specified in the table, thus filtering it from other ports. If the MAC address is not in the MAC address table (it is an unknown MAC address), or if it is a broadcast or multicast frame, floods the frame out every other port (within the same VLAN), except the port on which it arrived. Note that the switch does not change the addresses in the frame.
Loop Avoidance – Since the default behavior of a switch is to forward unknown unicast, broadcast, and multicast frames, it is possible for one frame to loop endlessly through a redundant (multiple path) network. Thus the Spanning Tree Protocol (STP) is used, to stop loops in a redundant switch network.
Collision Domains and Broadcast Domains
- All devices that share the same bandwidth could potentially have an Ethernet collision, and are said to be in the same collision domain. All devices to which a broadcast frame will go are said to share the same broadcast domain.
- All ports on a hub are in the same collision domain and in the same broadcast domain.
- Each port on a layer 2 switch is in its own collision domain. All ports on a layer 2 switch that are in the same VLAN are in the same broadcast domain.
- Each port on a router is in its own collision domain and in its own broadcast domain.
Redundant Topology – Unknown frames are flooded out all ports (within the same VLAN) except the port on which the frame arrived. If there are multiple paths, then a flooded frame may return back in to the same switch on another port, thus creating a loop.
Multiple Frame Copies – Unknown frames are flooded out all ports (within the same VLAN) except the port on which the frame arrived. If there are multiple paths (redundancy), then a frame destined for a device may be forwarded over each of the multiple paths. The destination device would then receive multiple copies of the same frame.
MAC Database Instability – Unknown frames are flooded out all ports (within the same VLAN) except the port on which the frame arrived. The switch dynamically learns MAC addresses by reading the source MAC address of each arriving frame and recording the address and inbound port in its MAC address table. If there are multiple paths (redundancy), a switch may learn the same MAC address on different ports, at slightly different times. Thus, the MAC address table would change very quickly and may become unstable. The end result may also be an incorrect port number for a given MAC address.
Solution to Bridging/Switching Issues: 802.1d Spanning Tree Protocol
- Bridges/switches communicate with Bridge Protocol Data Units (BPDUs). BPDUs are sent by default every two (2) seconds and include the Bridge ID and the Root ID.
- Each bridge/switch has a unique Bridge ID, which is the priority (or priority and extend system ID) followed by the base MAC address of the bridge/switch. The priority has a default value but can be modified.
- The bridge/switch with the lowest Bridge ID becomes the Root Bridge. All other bridges/switches are called Nonroot Bridges.
- All ports on the Root Bridge are called Designated Ports and are forwarding.
- All Nonroot Bridges calculate their best (lowest cost) way to the Root; the port used for that path is called a Root Port. Every Nonroot Bridge has one Root Port.
- Every segment must have a Designated Port. If a segment is not connected to a Root Bridge, the Nonroot Bridges on the segment determine which of them will have the Designated Port. The bridge with the lowest Bridge ID will have the Designated Port. All other ports on that segment will be Blocked Ports, which are also called non-designated ports. Blocked ports do not forward traffic, but do listen for BPDUs.
- If a port does not receive BPDUs for a time (max_age), it transitions to the listening state, and the topology recalculates the Root, Nonroot, etc.
- Bridge/switch convergence is the time between a break occurring and STP calculating an alternate path. Convergence is typically 30 – 50 seconds.
- Cisco switches include STP enhancements:
- Portfast provides immediate transition of the port into STP forwarding mode upon linkup; portfast should only be enabled on ports not connected to another switch.
- UplinkFast provides improved convergence time of STP in the event of the failure of an uplink on an access switch. UplinkFast only reacts to direct link failure (failure of a link on the same switch) so a port on the access switch must physically go down in order to trigger the feature.
- BackboneFast can save a switch up to 20 seconds (max_age) when it recovers from an indirect link failure (failure of a link on another switch).
Solution to Bridging/Switching Issues: 802.1w Rapid Spanning Tree Protocol
- An enhancement to the 802.1d Spanning Tree Protocol is that it provides faster spanning tree convergence after a topology change. It incorporates features equivalent to Cisco PortFast, UplinkFast and BackboneFast for faster network reconvergence.
- An EDGE port corresponds to the PortFast feature, where a port is directly connected to an end station (and therefore cannot create a bridging loop) so it transitions to the forwarding state.
- The LINK TYPE is automatically derived from the duplex mode of a port. A port that operates in full-duplex is assumed to be point-to-point, while a half-duplex port is considered as a shared port by default.
- There are only three port states left in RSTP that correspond to the three possible operational states. The 802.1D disabled, blocking, and listening states are merged into a unique 802.1w discarding state.
Comparison of Bridges and Switches
|Softare-based||Hardware-based (port-level ASICs)|
|Relatively slow||Comparatively fast|
|One STP per bridge||Possibly many STPs per switch (possibly one per VLAN)|
|Typically up to 16 ports||Possibly hundreds of ports|
Forwarding Modes in a Switch
|Store-and-forward||The entire frame is buffered, the CRC is examined for errors and frame is checked for correct size.|
|Cut-through: fast-forward||The frame is forwarded once the destination MAC address (first 6 bytes) arrives.|
|Cut-through: fragment-free||The frame is forwarded once the first 64 bytes have arrived. Ethernet collisions usually occur within the first 64 bytes, thus if 64 bytes arrive there is no collision.|
Half-Duplex versus Full-Duplex
- Network devices use the same pair of wire to both transmit and receive, so it is only possible to use 50% of the available bandwidth (the same bandwidth is used to send and receive)
- Available bandwidth per device decreases as number of devices in the broadcast domain increases
- Used through hubs (layer 1 devices) – all devices share the available bandwidth
- Uses one pair of wire for sending and another pair for receiving.
- Effectively provides double the bandwidth; can send and receive at the same time.
- Must be point-to-point connections, such as a PC or server-to-switch or router-to-switch.
- Every device has its own collision domain on each switch port.
STP on Trunks
When STP is run on trunks, there are a variety of possibilities:
- Cisco ISL trunks use Per VLAN Spanning Tree (PVST), in which one instance of STP is run for each VLAN.
- Original 802.1q trunks use Common Spanning Tree (CST), in which one instance of STP is run for all VLANs.
- Cisco 802.1q trunks use PVST+, in which one instance of STP is run for each VLAN.
- 802.1s, multiple instances of spanning tree (MIST or MST, or MSTP), can also be run on 802.1q trunks. MSTP runs one instance of STP for a group of VLANs.
- On 802.1q trunks, Cisco switches support PVST+ or MSTP.
- With Rapid STP, PVST+ becomes PVRST+.
STP Port Costs
The STP cost is the sum of the costs along the path; the costs are based on bandwidth as follows:
|Bandwidth||STP Port Cost|
Excerpted and available for download from Global Knowledge White Paper: CCNA v1.1 Exam Review: Critical Concepts of the 640 – 802 CCNA Exam