User Tools

Site Tools


Action unknown: copypageplugin__copy
linux:vlan

VLAN

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
        • 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 <nic> name <nic>.<vlanid> type vlan id <vlanid>
  • ken een IP adres toe
    ip addr add <IP>/<mask> dev <nic>.<vlanid>
  • breng de interface up:
    ip link set dev <nic>.<vlanid> 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 <nic>.<vlanid>
  • om dit persistent te maken, voeg je dit toe aan /etc/network/interfaces
    auto <nic>.<vlanid>
    iface <nic>.<vlanid> inet static
        address <IP>
        netmask 255.255.255.0
        vlan-raw-device <nic>
  • 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

linux/vlan.txt · Last modified: by admin