Switches TP-Link — VLAN config
Setup minimum pour homelab minfra-v2 : 2 switches managés L2 avec VLAN 802.1Q. Permet à OPNsense (sur coruscant) de router LAN/WAN/DMZ proprement.
Architecture
Salon : box SFR + naboo + TV connectés au TP-Link salon. Garage : coruscant (Proxmox + OPNsense VM) + jedha NAS + autres serveurs sur TP-Link garage. Trunk Cat6 ~40m relie salon p8 ↔ garage p1, porte 3 VLANs.
VLANs
| ID | Nom | Subnet | Usage |
|---|---|---|---|
| 1 | Default | 10.0.1.0/24 | LAN (vlan natif, untagged) |
| 20 | WAN | 192.168.1.0/24 | Box SFR ↔ OPNsense WAN |
| 30 | DMZ | 10.0.2.0/24 | Containers/serveurs Docker exposés |
Vlan natif 1 = LAN car coruscant a IP 10.0.1.30 directement sur vmbr0 untagged (PVE bridge vlan-aware).
TP-Link salon (TL-SG108PE)
802.1Q VLAN Configuration
| VLAN ID | Name | Untagged Ports | Tagged Ports |
|---|---|---|---|
| 1 | Default | 2-8 | — |
| 20 | WAN | 1 | 8 |
| 30 | DMZ | — | 8 |
⚠️ Port 1 retiré du VLAN 1 Default — isole box SFR du LAN (sinon box répond DHCP 192.168.1.x aux clients LAN).
Port PVID
| Port | Équipement | PVID |
|---|---|---|
| g1 | Box SFR | 20 |
| g2 | naboo (PC) | 1 |
| g3 | Coin TV / Apple TV | 1 |
| g4-g7 | LAN libre | 1 |
| g8 | Trunk → garage | 1 |
TP-Link garage (TL-SG108PE, IP 10.0.1.3)
802.1Q VLAN Configuration
| VLAN ID | Name | Untagged Ports | Tagged Ports |
|---|---|---|---|
| 1 | Default | 1-8 | — |
| 20 | WAN | — | 1, 4 |
| 30 | DMZ | — | 1, 4 |
Port PVID
| Port | Équipement | PVID |
|---|---|---|
| g1 | Trunk → salon | 1 |
| g2 | LIBRE | 1 |
| g3 | endor (Mac Mini) | 1 |
| g4 | coruscant (trunk OPNsense) | 1 |
| g5 | yavin4-kvm | 1 |
| g6 | dagobah (RPi) | 1 |
| g7 | jedha (NAS) | 1 |
| g8 | yavin4 ESXi (trunk legacy) | 1 |
⚠️ Coruscant p4 doit recevoir vlan 1 untagged (LAN OPNsense) + tagged 20 (WAN) + tagged 30 (DMZ) → bridge vmbr0 vlan-aware Linux décode chaque vlan vers les NICs virtuelles VM 200 (OPNsense).
Pièges à éviter
- Save Config explicite : Apply ≠ Save. Sans Save → perdu au reboot switch.
- Box SFR isolée : port box SFR PVID 20 + Not Member vlan 1 untagged. Sinon DHCP race box SFR vs OPNsense Kea.
- VLAN 10 inutile : ancien plan (
vlan 10 = LAN) abandonné. LAN = vlan natif 1 → simplifie config + matche coruscant. - PVID g8 (trunk salon) = 1 : pour porter native vlan 1 untagged (LAN) vers trunk.
- OPNsense Kea conflit dnsmasq : dnsmasq DHCP doit être stoppé (port 67). Géré par Ansible role
opnsense(taskdhcp: désactiver dnsmasq DHCP).
Vérification
# Depuis naboo : ping OPNsense LAN
ping 10.0.1.1
# Internet via OPNsense WAN
ping 1.1.1.1
# Switch garage joignable
ping 10.0.1.3
# DHCP test depuis PC sur tp-link p3
ipconfig /release ; ipconfig /renew # Windows
# Doit obtenir 10.0.1.X via Kea OPNsense
Debug
Voir DHCP arriver côté coruscant :
ssh root@10.0.1.30 'tcpdump -i nic0 -nn -e -c 10 udp port 67 or 68'
Voir DHCP côté OPNsense LAN :
ssh -J root@10.0.1.30 root@10.0.1.1 '/bin/sh -c "tcpdump -i vtnet0 -nn -e -c 10 udp port 67 or 68"'
Logs Kea :
ssh -J root@10.0.1.30 root@10.0.1.1 '/bin/sh -c "tail -50 /var/log/kea/latest.log"'
Conflit dnsmasq DHCP :
ssh -J root@10.0.1.30 root@10.0.1.1 '/bin/sh -c "sockstat -l4 | grep :67"'
# Doit voir kea-dhcp4 uniquement, PAS dnsmasq