What you are building
One Ubuntu environment becomes a small campus fabric with three switches, two VLANs and three isolated hosts.
Prepare WSL2 Ubuntu
Download the script into your Linux home folder. Do not run it from /mnt/c.
Open Ubuntu
Open Windows Terminal and choose your Ubuntu profile. One terminal is enough. A second terminal is useful later for live observation.
Download the lab script
Use the download button at the top of this page, then copy the file into your WSL home directory.
cp /mnt/c/Users/YOUR-WINDOWS-USER/Downloads/mission-switching-lab-v2.sh ~/
cd ~
chmod +x mission-switching-lab-v2.shYOUR-WINDOWS-USER to the folder name shown under C:\Users. You can also drag the downloaded script into your Ubuntu home folder using File Explorer at \\wsl$\Ubuntu\home\YOUR-LINUX-USER.I already have the script in Ubuntu
pwd. A path beginning with /home/ is correct. A path beginning with /mnt/c/ should be moved first.Run preflight checks
Install the small open-source toolset, then prove WSL can create a Linux bridge before building anything.
Install tools
sudo ./mission-switching-lab-v2.sh install- What it does
- Updates Ubuntu package metadata and installs iproute2, bridge tools, tcpdump, Python, curl, ping and process tools.
- Success
- The command ends with Packages installed.
If apt fails
Run the doctor
sudo ./mission-switching-lab-v2.sh doctor- Expected
- Every tool shows PASS, the script path begins with
/home/, and Linux bridge creation passes. - Stop here when
- The doctor reports a missing tool, a
/mnt/script path, or inability to create a bridge.
Your environment is ready only when the final line says Environment ready.
Troubleshooting: script still runs from /mnt/c
cp ./mission-switching-lab-v2.sh ~/
cd ~
chmod +x mission-switching-lab-v2.sh
sudo ./mission-switching-lab-v2.sh doctorTroubleshooting: permission denied
chmod +x mission-switching-lab-v2.shBuild the switching fabric
The script creates three bridges, three trunks, three namespaces, VLAN access ports and a small HTTP application.
sudo ./mission-switching-lab-v2.sh buildThe build pauses briefly while Spanning Tree settles. It does not open a menu or take over your terminal.
Verify the baseline
sudo ./mission-switching-lab-v2.sh verify- PASS 1
- Spanning Tree has a protected path.
- PASS 2
- Host A reaches Host B in VLAN 110.
- PASS 3
- Host A cannot reach the application in VLAN 120 without routing.
Do not continue until all three baseline checks pass.
The build failed. Show me the clean recovery
sudo ./mission-switching-lab-v2.sh destroy
sudo ./mission-switching-lab-v2.sh doctor
sudo ./mission-switching-lab-v2.sh build
sudo ./mission-switching-lab-v2.sh verifyThe Four Checks
Troubleshoot in order. Each check answers a different question, and no single check proves the whole network.
Physical
Question: Are the lab links up?
sudo ./mission-switching-lab-v2.sh physical- Good
- The
mls1links are UP and counters can increase. - Failure
- A required interface is DOWN or missing.
Spanning Tree
Question: Which healthy path is protected?
sudo ./mission-switching-lab-v2.sh stp- Good
mls1-coreis root and one triangle port is blocking.- Failure
- No protected path exists or an unexpected port is disabled.
Forwarding database
Question: Where did each switch learn the endpoint MAC?
sudo ./mission-switching-lab-v2.sh fdb- Good
- Dynamic MAC entries appear after traffic.
- Failure
- An expected source MAC is absent or learned on the wrong port.
VLAN
Question: Is VLAN 110 or 120 present with the right port behavior?
sudo ./mission-switching-lab-v2.sh vlan- Good
- Access ports show PVID and untagged. Trunks carry VLAN 110 and 120 tagged.
- Failure
- A VLAN is missing or an access port has the wrong PVID.
Continue only when you can explain what each check proves and what it cannot prove.
Find the root and the protected path
All three links are physically up. Spanning Tree allows two paths to forward and keeps one path ready but blocked.
sudo ./mission-switching-lab-v2.sh stp- Look for
mls1-corehas the lowest bridge priority and becomes root.- Look for
- At least one East-West port shows
blocking. - Meaning
- The cable works. The control plane is intentionally refusing ordinary forwarding on that path.
Watch port state only
sudo bridge link show | grep -E 'master mls1-(core|east|west)'Prove access ports and trunks
VLAN 110 carries the two users. VLAN 120 carries the application. Every inter-switch link carries both VLANs as tagged traffic.
sudo ./mission-switching-lab-v2.sh vlanVLAN 110, PVID, untagged.
VLAN 120, PVID, untagged.
VLAN 110 and VLAN 120 are present without PVID or untagged flags.
PVID Egress Untagged means the port behaves like an access port. A VLAN number without those flags is carried as tagged trunk traffic.Make the switches learn
Generate traffic, then inspect where each Linux bridge believes the endpoint MAC addresses live.
Generate A to B traffic
sudo ip netns exec mls1-host-a ping -c 3 10.110.0.12Inspect learned MAC addresses
sudo ./mission-switching-lab-v2.sh fdb- Host A MAC
02:00:00:00:11:0a- Host B MAC
02:00:00:00:11:0b- Learning rule
- A switch learns from the source MAC of frames arriving on a port.
Optional: watch MAC changes live
sudo bridge monitor fdbCut an active trunk
The protected East-West path should become usable after the active Core-West path disappears.
sudo ./mission-switching-lab-v2.sh scenario failoverOpen a second Ubuntu tab and watch the port states.
watch -n 1 "bridge link show | grep -E 'master mls1-(core|east|west)'"- First
mls1-cw-cgoes down.- Then
- The protected East-West port moves through Spanning Tree states.
- Finally
- Host A to Host B traffic recovers.
sudo ./mission-switching-lab-v2.sh fixDiagnose a quiet VLAN outage
Every link remains up and Spanning Tree remains healthy, but VLAN 110 disappears from one active trunk.
sudo ./mission-switching-lab-v2.sh scenario vlan-outageProve the exact failure
sudo bridge vlan show dev mls1-cw-wVLAN 110 is missing while VLAN 120 remains.
sudo ./mission-switching-lab-v2.sh fix
sudo ./mission-switching-lab-v2.sh verifyMove a MAC without changing the host
Move Host B to another access port while keeping the same MAC and IP. Normal movement is one clean update. Repeated movement between ports is flapping.
Trigger
sudo ./mission-switching-lab-v2.sh scenario mac-moveObserve
sudo ./mission-switching-lab-v2.sh fdb- Good
- Host B keeps MAC
02:00:00:00:11:0band IP10.110.0.12, but the learned port changes. - Diagnose
- One movement after a planned change is normal. Rapid repeated movement between ports suggests a loop, duplicate attachment or unstable topology.
Repair
sudo ./mission-switching-lab-v2.sh fixVerify
sudo ./mission-switching-lab-v2.sh verifyReach the Layer 2 boundary
Prove every switching check passes, then try to reach the application in another IP network.
sudo ./mission-switching-lab-v2.sh scenario routing- Source
- 10.110.0.11/24 in VLAN 110
- Destination
- 10.120.0.50/24 in VLAN 120
- Layer 2
- Physical, STP, FDB and VLAN checks pass.
- Missing
- No router, no default gateway, no matching route.
Routing Tables: Choosing the Next Hop
Routing table, default route, next hop and longest-prefix match.
Clean up completely
Remove every namespace, virtual cable and Linux bridge created by the workshop.
sudo ./mission-switching-lab-v2.sh destroyConfirm nothing remains
ip netns list
ip -br link show | grep '^mls1-' || echo "Lab removed"You built a Layer 2 fabric, found its protected path, proved VLAN trunks, watched MAC learning, triggered failover, diagnosed a quiet outage and discovered why routing comes next.