====== VLAN======
[[linux:linux|{{ :dokuwiki:tux.png?120|}}]]
===== context=====
dit document beschrijft hoe je VLANs activeert op linux.
===== Vooraf:=====
* controleer dat de poort waarop je linux hangt, een **trunk** poort is
* fysieke switch: trunk met native VLAN \\ Mative VLAN is de VLAN zonder tagging; doorgaans VLAN 1 tenzij anders geconfigureerd.
* (**ESXi**): **virtuele switch > PortGroup** met:
* VLAN: **4095**
* Security → Promiscuous Mode → Accept
* MAC address changes → Accept{{ :linux:chatgpt_image_oct_13_2025_11_57_49_am.png?400 |}}\\
* REJECT: default behaviour: VM ziet enkel verkeer voor eigen MAC
* ACCEPT: VM ziet alle verkeer uit de portgroup (dus: alle VLANs)
===== stappenplan=====
* log aan op de linux server en voer uit: apt install vlan
modprobe 8021q
* maak een VLAN interface aan ip link add link name . type vlan id
* ken een IP adres toe ip addr add / dev .
* breng de interface up: ip link set dev . up
* voorbeeld: ip link add link eth0 name eth0.10 type vlan id 10
ip addr add 192.168.10.2/24 dev eth0.10
ip link set dev eth0.10 up
* test met **tcpdump**:tcpdump -i .
* om dit persistent te maken, voeg je dit toe aan ''/etc/network/interfaces''
auto .
iface . inet static
address
netmask 255.255.255.0
vlan-raw-device
* voorbeeld:
auto eth0.10
iface eth0.10 inet static
address 192.168.10.2
netmask 255.255.255.0
vlan-raw-device eth0
===== meer info =====
[[https://dev.to/s3cloudhub/mastering-vlans-in-linuxunix-a-step-by-step-guide-6hf|Mastering Vlans in Linux/Unix]]
{{tag>Linux}}