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

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
    up ip addr add brd + dev eth0
    up ip addr add 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.

  • 1
    If each vlan is connected to a different dhcp server it is indeed possible to have a different dhcp address on each vlan. – Olivier S Jan 29 '12 at 8:00
  • I wanted to use this with virtual machines, I think it is possible to have a virtual network interface with its own MAC address, so if I did that would it be able to get multiple leases? – RayQuang Jan 29 '12 at 8:52
  • You are are all over the board here. Your question mrtions VLAN, The example syntax you gave was for aliasing, now you are talking about virtualization? Can you update your question and provide more detail about what you are trying to do? I don't think I understand what you want. – Zoredache Jan 29 '12 at 10:27
  • Sorry for the ambiguity, What I was trying to do was to setup multiple virtual interfaces on one machine with a single NIC.When I connect a switch to my modem it assigns one IP address to each device connected to it via DHCP. However I want to achieve this functionality using my public facing NIC on my server which only has one ethernet port (without the switch). This is why I was thinking it would be possible to make a virtual interface or use a virtual interface with a virtual MAC address (and I know some virtualization software emulates this well). – RayQuang Jan 29 '12 at 15:38

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.