Routing and Switching: STP, LACP, and Inter-VLAN Routing
I built a loop-free switching fabric using Rapid STP, aggregated uplinks with LACP, and enabled inter-VLAN routing on a Layer 3 switch. The design eliminated Layer 2 loops while providing redundant, load-shared uplinks with sub-second failover.
Objective & Context
Switching forwards within a broadcast domain; routing moves between them. This lab combines RSTP loop prevention, 802.3ad link aggregation for bandwidth and redundancy, and SVI-based inter-VLAN routing to connect the VLANs from the segmentation lab.
Learning Objectives
- Enable Rapid STP and interpret port roles and states.
- Bundle redundant links with LACP (802.3ad) for bandwidth and failover.
- Create SVIs for inter-VLAN routing on a Layer 3 switch.
- Verify loop-free topology and bundle membership.
- Explain when to route on an SVI vs a dedicated router interface.
Environment & Prerequisites
Prerequisites
- Two managed switches with RSTP and LACP support.
- Pre-configured VLANs (10/20/30/40) and a Layer 3 switch.
- Redundant inter-switch links for the LACP bundle.
- Two managed switches with RSTP and LACP (802.3ad) support.
- Pre-configured VLANs 10/20/30/40 from the VLAN lab.
- A Layer 3 switch or router for the inter-VLAN SVIs.
- Redundant inter-switch links for the LACP bundle.
- Console or management access to both switches.
inter-VLAN SVIs]
Step-by-Step Execution
1. Enable Rapid STP
spanning-tree mode rapid-pvstExpected output:
SW1(config)# spanning-tree mode rapid-pvst
SW1(config)#
(verify with: show spanning-tree vlan 20)
What this teaches: RSTP blocks redundant ports logically so the physical loop never becomes a broadcast storm.
2. Bundle uplinks with LACP
interface range Gi0/1-2 ; channel-group 1 mode activeExpected output:
SW1(config)# interface range Gi0/1-2
SW1(config-if-range)# channel-group 1 mode active
Creating a port-channel interface Port-channel 1
SW1(config-if-range)# exit
SW1(config)#
What this teaches: LACP negotiates the bundle dynamically, so both ends must agree on active or passive mode.
3. Create an inter-VLAN SVI
interface vlan 20 ; ip address 192.168.20.1 255.255.255.0 ; no shutdownExpected output:
Port-channel1 LACP active Gi0/1 Gi0/2 bundled
Vlan20 up/up 192.168.20.1
What this teaches: an SVI is a virtual Layer 3 interface that lets the switch route between VLANs directly.
How It Works
Switching forwards frames within a broadcast domain using MAC tables; routing forwards packets between domains using IP tables. A Layer 3 switch does both: it switches at wire speed in hardware and routes through SVIs, which are virtual interfaces bound to VLANs with their own IP addresses.
Redundant links create loops, and loops create broadcast storms, so STP exists to block redundant paths logically while keeping them physically connected. RSTP converges in seconds rather than the 30 to 50 seconds of classic STP by using handshake-based proposals between switches instead of timer-based aging.
LACP bundles multiple physical links into one logical channel. Traffic is distributed across member links by a hashing algorithm (usually source/destination MAC or IP), and if a member fails, its traffic moves to the survivors in under a second. Both ends must run LACP in compatible modes (active/passive); a static bundle with no negotiation is the brittle alternative.
Validation & Testing
Disconnect one bundle member and confirm traffic continues over the survivor; verify RSTP shows one forwarding path. Pass criteria: no loop, sub-second LACP failover, and successful inter-VLAN routing via the SVIs.
show etherchannel summary ; show spanning-tree vlan 20 briefExpected output:
SW1# show etherchannel summary
Group Port-channel Protocol Ports
------+-------------+-----------+----------------------------
1 Po1(RU) LACP Gi0/1(P) Gi0/2(P)
SW1# show spanning-tree vlan 20 brief
VLAN20
Spanning tree enabled protocol rstp
Root ID Priority 4096
Address aabb.cc00.0100
This bridge is the root
RU means the bundle is in use, P means each member is bundled in the port-channel. Confirm the RSTP root is the intended switch before calling the topology loop-free.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Bundle members show suspended or standalone | LACP mode mismatch (one side active, other side on) or no LACP at all | Set both sides to active (or active/passive pair) and check show etherchannel summary |
| RSTP still takes ~30s to converge | A legacy 802.1D neighbor forces fallback timers | Identify the old switch with show spanning-tree and isolate or upgrade it |
| Inter-VLAN routing fails | SVI down because no access port in that VLAN is up, or missing IP routing | Confirm the SVI is up/up and ip routing is enabled on the L3 switch |
| Traffic uses only one bundle member | Hashing algorithm sends the test flows down the same link | This is normal: LACP balances flows, not packets; test with diverse source/destination pairs |
| Loop despite STP | A device with STP disabled bridging two VLANs, or a unidirectional link | Enable loop guard and UDLD on fiber links; audit for unmanaged switches |
| channel-group accepted but member stays suspended | Member interfaces differ in speed, duplex, or trunk allowed list, so LACP cannot bundle them | Match speed/duplex and trunk config on all members, then shut/no shut the port-channel |
Advanced: Troubleshooting
- LACP not bundling: both ends must be active/passive compatible with matching speed/duplex.
- STP blocking wrong port: set bridge priority to elect the intended root.
- No inter-VLAN routing: enable
ip routingon the L3 switch.
Key Results
- Eliminated Layer 2 loops with RSTP across redundant links.
- Achieved sub-second failover on LACP member loss.
- Doubled inter-switch bandwidth via a 2-link 802.3ad bundle.
- Routed all 4 VLANs through SVIs on a single L3 switch.
Key Takeaways
- RSTP gives fast convergence, but only if every switch in the domain speaks it.
- LACP needs matching modes on both ends; verify the bundle, do not assume it.
- An SVI needs at least one up port in its VLAN to stay up.
- Hashing balances flows across members; single-flow tests will not show aggregation.
Practice Challenges
Challenge 1: Measure failover time
Goal: Run a continuous ping across the bundle, pull one member link, and measure the outage duration.
Hint: Use ping with 100 ms intervals and timestamp the gap when the member goes down.
Challenge 2: Tune STP costs
Goal: Force a specific switch to become root for VLAN 20 by tuning priority, then verify with show spanning-tree.
Hint: Lower the bridge priority with spanning-tree vlan 20 priority 4096 on the desired root.