User Tools

Site Tools


linux:vlan

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
linux:vlan [2025/10/12 19:22] adminlinux:vlan [2025/10/13 11:16] (current) – [Vooraf:] admin
Line 6: Line 6:
 dit document beschrijft hoe je VLANs activeert op linux. 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===== ===== stappenplan=====
-  * controleer op de switch dat de poort waarop je linux hangt, een **trunk** poort is met native vlan 1. 
   * log aan op de linux server en voer uit: <code>apt install vlan   * log aan op de linux server en voer uit: <code>apt install vlan
-modpobe 8021q</code> +modprobe 8021q</code> 
-  * maak een VLAN interface aan <code>ip link add link <nic> name eth0.<vlanid> type vlan id <vlanid></code> +  * maak een VLAN interface aan <code>ip link add link <nic> name <nic>.<vlanid> type vlan id <vlanid></code> 
-  * ken een IP adres toe <code>ip addr add 192.168.10.2/24 dev eth0.10</code> +  * ken een IP adres toe <code>ip addr add <IP>/<mask> dev <nic>.<vlanid></code> 
-  * breng de interface up: <code>ip link set dev eth0.10 up</code>+  * breng de interface up: <code>ip link set dev <nic>.<vlanid> up</code> 
 +  * voorbeeld: <code>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 
 +</code> 
 +  * test met **tcpdump**:<code>tcpdump -i <nic>.<vlanid></code>
   * om dit persistent te maken, voeg je dit toe aan ''/etc/network/interfaces'' <code>   * om dit persistent te maken, voeg je dit toe aan ''/etc/network/interfaces'' <code>
 +auto <nic>.<vlanid>
 +iface <nic>.<vlanid> inet static
 +    address <IP>
 +    netmask 255.255.255.0
 +    vlan-raw-device <nic>
 +</code>
 +  * voorbeeld: <code>
 auto eth0.10 auto eth0.10
 iface eth0.10 inet static iface eth0.10 inet static
Line 20: Line 41:
     vlan-raw-device eth0     vlan-raw-device eth0
 </code> </code>
 +
 ===== meer info ===== ===== meer info =====
-voeg hier linken toe naar verdere uitleg+[[https://dev.to/s3cloudhub/mastering-vlans-in-linuxunix-a-step-by-step-guide-6hf|Mastering Vlans in Linux/Unix]]
 {{tag>Linux}} {{tag>Linux}}
  
linux/vlan.1760296961.txt.gz · Last modified: by admin