User Tools

Site Tools


linux:vlan

This is an old revision of the document!


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 (1)
    • (ESXi): virtuele switch > PortGroup met:
      • VLAN: 4095
      • Security → Promiscuous Mode → Accept
      • MAC address changes → Accept
        • links: default behaviour: VM ziet enkel verkeer voor eigen MAC
        • rechts: VM ziet alle verkeer uit de portgroup (dus: alle VLANs)

stappenplan

  • log aan op de linux server en voer uit:
    apt install vlan
    modpobe 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.1760350062.txt.gz · Last modified: by admin