The idea
Dana's dealership has two buildings, two VLANs and one cable under the yard. Make that cable carry both VLANs, then watch one small disagreement between its two ends drop office traffic into the workshop, with no Router anywhere near it.
Steps
-
Ping across the yard
Dana sells cars from two buildings, a showroom and a garage across the yard. Each building has a Switch,
showroomSwitchandgarageSwitch, and one cable runs between them under the concrete. A second cable means a second trench, and the quote for that was more than a used car.The dealership runs two VLANs, groups of ports a switch keeps apart as if they were separate networks. VLAN 30 is the office, with
advisorDeskin the showroom andfinanceDeskabove the garage, and it holds customers' loan papers. VLAN 40 is the workshop, withserviceDeskin the showroom andliftTabletin the garage, and those tablets get passed around by whoever has greasy hands, so they stay out of the office VLAN.A technician set up each switch on a separate day, and each one checks out. The two office desks are both in VLAN 30, and both have addresses starting
10.0.30, the same Subnet and prefix length, so one ought to reach the other. Ping from one to the other, then read each switch's port list.advisorDesk:~# ping -c 1 -W 2 10.0.30.20 showroomSwitch:~# bridge vlan show garageSwitch:~# bridge vlan show
-
Open the cable at one end
Early VLAN networks solved this with more cable, one between the switches for each VLAN. That works for two VLANs and falls apart at fifty, when a 48-port switch has no port left for a single desk.
The idea that fixed it was to write the VLAN's number on the traffic itself. In 1998 the IEEE, the body that writes the Ethernet standards, approved 802.1Q, where a switch adds a 4-byte tag to each frame, the unit it carries, as the frame leaves by a shared cable. With a number on every frame, traffic from many VLANs can share a cable and still be told apart at the far end.
A port that carries several VLANs this way is a Trunk. On a Linux switch, you make one by adding VLANs to the port's list, and
bridge vlan add dev garageSwitch vid 30says: on the port calledgarageSwitch, add VLAN 30. With no other words the VLAN stays tagged, so its frames cross with the number on them.Do that at the showroom end only, then ping again. The lab listens in two places in the garage: on the cable where it arrives, and on
financeDesk.showroomSwitch:~# bridge vlan add dev garageSwitch vid 30 showroomSwitch:~# bridge vlan show dev garageSwitch advisorDesk:~# ping -c 1 -W 2 10.0.30.20
-
Send everything down one cable
Finish the job. Add VLAN 30 at the garage end, then VLAN 40 at both ends, so the workshop crosses the yard too.
Then watch the cable while three different things use it.
advisorDeskpingsfinanceDeskin VLAN 30, andserviceDeskpingsliftTabletin VLAN 40. The third is the switches themselves: each has an address of its own,10.0.1.2and10.0.1.3, so that a technician can reach it, and those addresses sit in VLAN 1.tcpdumpprints what crosses a port. It starts first and keeps watching the cable while the pings go by, and it stops by itself after six frames, which is three pings and their three replies.garageSwitch:~# bridge vlan add dev showroomSwitch vid 30 garageSwitch:~# bridge vlan add dev showroomSwitch vid 40 showroomSwitch:~# bridge vlan add dev garageSwitch vid 40 showroomSwitch:~# bridge vlan show dev garageSwitch showroomSwitch:~# tcpdump -n -e -l -c 6 -i garageSwitch icmp advisorDesk:~# ping -c 1 -W 2 10.0.30.20 serviceDesk:~# ping -c 1 -W 2 10.0.40.20 showroomSwitch:~# ping -c 1 -W 2 10.0.1.3
-
Move the native VLAN at each end
Audit checklists say to move the native VLAN off VLAN 1, since VLAN 1 is where every forgotten port lands. Dana's auditor says so too, and she books two technicians, one for each building.
The showroom technician makes the office VLAN native at that end, and the garage technician makes the workshop VLAN native at the other. Neither speaks to the other, and each types a correct command.
Play both of them.
pvidanduntaggedare the two words you read on the port's list a moment ago. Then repeat the office ping, with the lab recording on both machines in the garage, and try the workshop's ping too.showroomSwitch:~# bridge vlan add dev garageSwitch vid 30 pvid untagged garageSwitch:~# bridge vlan add dev showroomSwitch vid 40 pvid untagged showroomSwitch:~# bridge vlan show dev garageSwitch garageSwitch:~# bridge vlan show dev showroomSwitch advisorDesk:~# ping -c 1 -W 2 10.0.30.20 serviceDesk:~# ping -c 1 -W 2 10.0.40.20
-
Make both ends agree
A native VLAN is a setting at each end of a cable, and nothing in the frame checks it. So the fix is a rule that people have to keep, which is the same native VLAN at both ends, every time.
The auditor's advice was sound, and only the execution failed, so do the job she asked for. Pick VLAN 999, a number no machine uses, and make it native. Every real VLAN then goes back to tagged, VLAN 1 included, since the switches' own addresses live there.
That's three commands at the showroom end. The first moves the native role to 999, and the next two name VLAN 1 and VLAN 30 with no extra words, which clears
pvidanduntaggedfrom each. The lab does the same at the garage end, as if the second technician were on the phone this time.Then read both ends and repeat the pings, with the lab recording on
liftTabletand on the cable.showroomSwitch:~# bridge vlan add dev garageSwitch vid 999 pvid untagged showroomSwitch:~# bridge vlan add dev garageSwitch vid 1 showroomSwitch:~# bridge vlan add dev garageSwitch vid 30 showroomSwitch:~# bridge vlan show dev garageSwitch garageSwitch:~# bridge vlan show dev showroomSwitch showroomSwitch:~# tcpdump -n -e -l -c 4 -i garageSwitch icmp advisorDesk:~# ping -c 1 -W 2 10.0.30.20 showroomSwitch:~# ping -c 1 -W 2 10.0.1.3
Run these steps on real machines