Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a Ubuntu pc with one interface -- eth0 -- which is connected to an unmanaged switch which is linked to two subnets: and I want to have two virtual interfaces with different MAC's on Ubuntu pc to connect to both the subnets (each virtual interface is connected to a different subnet). I do not want an alias (eth0:0), because I also want to add default gateways ( and of both subnets. What I want is something like another dumb virtual switch inside Ubuntu pc to which I can add two or more virtual interfaces. I tried the answer here, but when I ping the ip of the virtual interface I get the MAC of eth0. Also I created a bridge and gave different ips representing different subnets to br0 and eth0, but that too didn't work. I have tried every possible howto and I have also googled for months on the issue: the only solution seems to be to buy another network card and plug both to my unmanaged switch.

share|improve this question
This would be really easy if you had a managed switch with VLAN support. – larsks Mar 26 '12 at 2:21
Also, you cannot have multiple default gateways. It's called a "default" gateway for a reason. How would the system know which to use if there were more than one of them? – Patrick Mar 26 '12 at 12:01
@larsks If I have two links from different ISP's who provide me /29 subnets each, would I be able to have seprate virtual interfaces for each of the IP's (all 10 ip's from both ISP's) with only a physical connection to a managed switch? – nixnotwin Mar 26 '12 at 13:50
If you have a switch with VLAN support, then you can trunk multiple layer 2 networks over a single physical cable. You create multiple VLAN interfaces on your Linux that will act to most intents and purposes like separate physical interfaces. Take a look at this document and see if it makes sense. – larsks Mar 26 '12 at 14:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.