Set Up VLANs and Now Nothing Talks? Check the Trunk
You split the homelab into VLANs: one for your PCs, one for your servers. Now the PCs can't reach the servers. Let's find which part of the new setup isn't carrying traffic.
A homelab split into two VLANs on one managed switch: the PC on VLAN 10, a media server and a NAS on VLAN 20. A router routes between them over a single trunk cable from the switch. Each device is its own container.
The lab
Here is the lab. The PC is on VLAN 10. The media server and the NAS are on VLAN 20. They all plug into one managed switch. A single cable runs from the switch to the router, and it has to carry both VLANs. That cable is the trunk. The router has an address on each VLAN, and routes between them.
The symptom
curl -m 5 http://10.0.20.80
curl: (28) Connection timed out after 5001 milliseconds
What this shows
From the PC, curl asks the media server on VLAN 20 for its page. After five seconds it gives up: connection timed out.
Narrowing it down
ping -c 3 -W 1 10.0.20.1
PING 10.0.20.1 (10.0.20.1) 56(84) bytes of data. --- 10.0.20.1 ping statistics --- 3 packets transmitted, 0 received, 100% packet loss, time 2033ms
What this shows
Start from the server's side. To leave its VLAN, the server needs its gateway, the router's address on VLAN 20, 10.0.20.1. Three pings, no replies.
ip neigh show
10.0.20.1 dev eth1 FAILED
What this shows
ip neigh shows why. 10.0.20.1 is marked failed: the server asked for it on its own network, and nothing answered.
ping -c 3 10.0.20.30
PING 10.0.20.30 (10.0.20.30) 56(84) bytes of data. 64 bytes from 10.0.20.30: icmp_seq=1 ttl=64 time=0.070 ms 64 bytes from 10.0.20.30: icmp_seq=2 ttl=64 time=0.038 ms 64 bytes from 10.0.20.30: icmp_seq=3 ttl=64 time=0.039 ms --- 10.0.20.30 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2024ms rtt min/avg/max/mdev = 0.038/0.049/0.070/0.014 ms
What this shows
But the NAS, on the same VLAN, answers three out of three. Inside VLAN 20, the switch is passing traffic. It's the way out of VLAN 20 that's missing.
ping -c 3 10.0.10.1
PING 10.0.10.1 (10.0.10.1) 56(84) bytes of data. 64 bytes from 10.0.10.1: icmp_seq=1 ttl=64 time=0.051 ms 64 bytes from 10.0.10.1: icmp_seq=2 ttl=64 time=0.047 ms 64 bytes from 10.0.10.1: icmp_seq=3 ttl=64 time=0.042 ms --- 10.0.10.1 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2056ms rtt min/avg/max/mdev = 0.042/0.046/0.051/0.003 ms
What this shows
On the other side, the PC pings its own gateway, the router's address on VLAN 10. Three replies. VLAN 10 reaches the router fine.
Finding the cause
ip -br addr show type vlan
eth1.10@eth1 UP 10.0.10.1/24 fe80::a8c1:abff:fed2:592b/64 eth1.20@eth1 UP 10.0.20.1/24 fe80::a8c1:abff:fed2:592b/64
What this shows
On the router, this lists just its VLAN interfaces. Both are there and up: eth1 dot 10 with 10.0.10.1, and eth1 dot 20 with 10.0.20.1. They share the one cable, eth1, to the switch. The router is ready for both VLANs.
bridge vlan show
port vlan-id eth2 10 PVID Egress Untagged eth3 20 PVID Egress Untagged eth1 10 eth4 20 PVID Egress Untagged br0 1 PVID Egress Untagged
What this shows
That leaves the switch. bridge vlan show lists which VLANs each port carries. The PC's port, eth2, is on VLAN 10. The server and NAS ports, eth3 and eth4, are on VLAN 20. Those three are marked untagged: they're plain access ports for one VLAN. Now eth1, the trunk to the router. It lists only VLAN 10. VLAN 20 isn't on it.
The fix
bridge vlan add vid 20 dev eth1
(no output)
What this shows
bridge vlan add puts VLAN 20 on eth1.
bridge vlan show dev eth1
port vlan-id
eth1 10
20What this shows
And the trunk now lists 10 and 20.
ping -c 3 10.0.20.1
PING 10.0.20.1 (10.0.20.1) 56(84) bytes of data. 64 bytes from 10.0.20.1: icmp_seq=1 ttl=64 time=0.040 ms 64 bytes from 10.0.20.1: icmp_seq=2 ttl=64 time=0.039 ms 64 bytes from 10.0.20.1: icmp_seq=3 ttl=64 time=0.082 ms --- 10.0.20.1 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2028ms rtt min/avg/max/mdev = 0.039/0.053/0.082/0.020 ms
What this shows
From the server, the gateway answers: three out of three.
curl -m 5 http://10.0.20.80
<!doctype html> <title>homelab media server</title> <h1>homelab media server</h1> <p>It works.</p>
What this shows
And from the PC, the media server's page loads across the VLANs. It works.
Why it broke
So why did VLAN 20 go quiet while VLAN 10 kept working? A trunk only carries the VLANs that are listed on it. Inside VLAN 20, the switch still connected the server and the NAS, so that looked fine. But VLAN 20's traffic had no way onto the cable to the router, so nothing on VLAN 20 could reach its gateway, or anything beyond it. When you add a VLAN to a homelab, it has to be added to every trunk on the way to its router.
When one VLAN can talk to itself but nothing else, check its gateway first, then check that every trunk on the way carries that VLAN.
Try it yourself
The whole lab runs on your own computer with Docker and containerlab: get it on GitHub, then ./lab.sh up and ./lab.sh break. Setup steps are on Run the labs.