My Ubuntu Server has one physical interface eth0
. I want to assign 3 ip's (different subnets) to the server. I cannot use the default virtual interface creation tools like ifconfig
or ip addr add
(e.g. eth0:0
) because for each of those 3 ip's I need to specify a default gateway. So, whether it is possible to have a bridge to which I can attach eth0
( and multiple tap or tun interfaces with ips that I want), but each of the virtual devices can connect to subnets accessbile over eth0
.
EDIT1:
Imagine I want 5 ethernet interfaces to connect to 5 different networks. But I can't afford to have 5 interfaces. So I buy an unmanaged switch, and connect cat5 cables from all the 5 networks to that switch and one port of that switch in connected to eth0
of Ubuntu server. In order to deal with all 5 networks on Ubuntu server, I create 5 virtual interfaces that behave like physical interfaces (eth1, eth2, so on ..), that traverse through eth0
and end up at the switch. I don't mind if all those seperate networks traverse through one unmanaged switch. But I want my Ubuntu server to treat those networks as if they are attached to 5 physical interfaces.
Best Answer
You can only have one default route on a system.
You can add static routes in to force some traffic to go via a different router:
or
These commands can be added to /etc/network/interfaces.