8

I am trying to setup vlans on my eth0 network card. The following are the steps that I've taken:

  1. Install vlan with sudo apt-get install vlan
  2. Edit /etc/network/interfaces in vi by adding:

    auto eth0.100
    iface eth0.100 inet dhcp
    
  3. Restarted networking and/or restarted Ubuntu

  4. Ran ifconfig

I don't see the eth0.100 listed, I'm not sure what I am doing wrong.

I can add vlans using vconfig but they don't stay after a reboot.

12

First you must install

   sudo apt-get install vlan

load kernel module

   sudo modprobe 8021q

Create a new interface that is a member of a specific VLAN, VLAN id 100

We use the physical interface eth0 in this example. This command will add an additional interface next to the interfaces which have been configured already

   sudo vconfig add eth0 100

Assign an address to the new interface.

   sudo ip addr add 10.0.0.1/24 dev eth0.100

To make this setup permanent. Add the module to the kernel on boot

   sudo su -c 'echo "8021q" >> /etc/modules'

Create the interface and make it available when the system boots. Add the following lines to /etc/network/interfaces

auto eth0.100
iface eth0.100 inet dhcp
    vlan-raw-device eth0
  • Why does the new interface need an IP assigned to it? Could this step be skipped and the interface pickup a dynamic IP on the next boot? – hammertime Aug 13 '15 at 11:20
  • Yes, can be skiped. This is only example. At the end on answer you have config for eth0.100 for you. – 2707974 Aug 13 '15 at 11:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.