Multiple virtual VLAN interfaces on single NIC (Debian)

I'm trying to setup multiple virtual interfaces with VLAN's on a single NIC. I'm running Debian Squeeze.

Currently this is my /etc/netowrk/interfaces

auto eth0.10
iface eth0.10 inet dhcp

This gives me a working connection, however I'm not sure how to configure several like these on a single NIC so I can use multiple external IP's.

I have tried aliasing the VLAN's like so: iface eth0.10:1 But that was not successful and it said failed to bring up interface.

And suggestions would be greatly appreciated :)


If you are really talking about VLANs (802.1q), then this is for your network/interfaces:

auto vlan42
iface vlan42 inet static
        vlan-raw-device eth0
        address   10.1.2.3
        netmask   255.255.255.0

Your eth0 can be configured just like a normal interface which is then the untagged (aka native) VLAN.

I think it should be possible to use inet dhcp instead of inet static and omit the address and netmask parameters.

Oh, and the vlan package has to be installed!


Having sub-interfaces to add addition addresses to a single device really isn't something that is required, or reccommended any longer. If you want multiple addresses it is much better to simply add the address to the current interface.

auto eth0
iface eth0.10 inet static
    address 192.168.1.1
    netmask 255.255.255.0
    up ip addr add 192.168.1.2 brd + dev eth0
    up ip addr add 192.168.1.3 brd + dev eth0

If you are somehow expecting a sub-interface to allow you to use DHCP to get multiple addresses, then I have to tell you, that simply is not going to be possible.

DHCP is keyed on the MAC address of the network device. Adding another psedo interface in the software of the client isn't going to change the MAC address the server sees.