Debian VLAN (8021q) Configuration doesn't work

10,946

First of all, is the host machine network interface is connected to the trunked port ? you can test this simple with the command vconfig to create the vlan interface on the fly,

# vconfig add [interface-name] [vlan-id]
# ( you will need 8021q module loaded )
# -e.g. 
vconfig add em1 100
ip addr show

...
12: em1.100@em1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether f0:de:f1:54:d8:55 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::f2de:f1ff:fe54:d855/64 scope link 
       valid_lft forever preferred_lft forever

set up the ip address and make sure you can communicate on this vlan


EDIT: trunk interface in a vm

There 2 ways you can access you networks,

  1. Create the vlan interfaces on the host and bridge to them
  2. Bridge to the trunk interface and then create the vlan on the vm
Share:
10,946

Related videos on Youtube

user2927980
Author by

user2927980

Updated on September 18, 2022

Comments

  • user2927980
    user2927980 over 1 year

    I try to setup VLANs on a virtual Debian machine. It's connected to an Cisco 2960 Switch. The Switch has 3 VLANs (1,100,200) which're allowed the pass the trunk. The Switch Configurations was tested with an other layer2 switch, which was also configured as trunk. It worked perfectly so it has to be the VM.

    The 8021q Kernel Module is loaded but "Used by" is set to 0.

    The Network Configuration of the Debian Host looks like:

    auto eth0.1
    iface eth0.1 int static
        address 192.168.0.1
        netmask 255.255.255.0
        vlan_raw_device eth0
    
    auto eth0.100
    iface eth0.100 int static
        address 192.168.1.1
        netmask 255.255.255.0
        vlan_raw_device eth0
    
    auto eth0.200
    iface eth0.200 int static
        address 192.168.2.1
        netmask 255.255.255.0
        vlan_raw_device eth0
    

    When I try to ping the IP of the Switch I get back

    From 192.168.1.1 icmp_swq=1 Destination Host Unreachable
    

    I would realy appreciate Help!

    • Rabin
      Rabin almost 10 years
      is your VM network interface bridged to a interface with can access the trunk ?
    • user2927980
      user2927980 almost 10 years
      How do I figure this out?
  • user2927980
    user2927980 almost 10 years
    Sry I missunderstood you. Yes the interface is connected (bridged) to the trunk port. Without the virtual interfaces I'm able to ping into the native vlan. But the virtual interfaces don't work. As soon as I setup an virtual interface with the same configurations as eth0, I'm not able to ping in the native vlan anymore.
  • Rabin
    Rabin almost 10 years
    sound like your port is not trunk.
  • user2927980
    user2927980 almost 10 years
    Well which one? The Interface on the switch is definitley set to trunk. So it must be the VM...
  • Rabin
    Rabin almost 10 years
    doesn't sound right - if you can access the network, with a basic interface which is not a vlan interface.
  • user2927980
    user2927980 almost 10 years
    Maybe it's the virtual layer inbetween... idk...
  • user2927980
    user2927980 almost 10 years
    never mind... :-)