Skip to content

Add a vlan on debian

Network interface

should be configured like below

Edit /etc/network/interface

auto eth3
iface eth3 inet manual

Add vlan with cli

Load module for vlan:

modprobe 8021q

Install package

apt-get install vlan

Configure vlan

vconfig add eth3 2078    # 2078 is vlan number

Lifting up vlan

ifconfig vlan2078 up
or
ip link set vlan2078 up

Show vlans

ip link show vlan2078
ifconfig vlan2078

Add vlan at startup

Edit file /etc/network/interface add following to file

    auto vlan2078
    iface vlan2078 inet manual
        mtu 1500
        vlan_raw_device eth3

How to discover in what vlan a port can be if is not a switch/port configured in access mode

For CISCO CDP

# tcpdump -nn -v -i eth0 -s 1500 -c 1 'ether[20:2] == 0x2000' 

For Juniper LDP

# tcpdump -nn -v -i eth0 -s 1500 -c 1 '(ether[12:2]=0x88cc or ether[20:2]=0x2000)'