Is there any alternative to virtualization for handling two different interfaces, different networks and same IP range?

I have a Linux box with two different NICs that are connected to two different networks, but they share the same IP range (10.0.0.x). My first idea was to use virtualization for that (i.e., Xen), but it seems to me overkill since I want to use the same programs without conflicts due routing.

I was wandering if there is a way to confine a NIC to something like a shell session, so all programs launched from there use only that NIC, like launching a bash session that only sees eth1 but not eth0.

edit: I guess I'm looking something similar to FreeBSD jails but for Linux


If both the network address and subnet masks for the two separate networks are identical, your network is misconfigured in a way that defeats the basic intent of IP-routing.

I would renumber one of the networks.


Hmm, it seems I'm not describing well my problem. - @Darth Android At best, 'misconfigured' is infortunate to describe the situation: you're correct that this scenario generates a conflict in the routing table, but I'm trying to find a solution for that having two routes isolated from each other. The other solution would be using a proxy NAT, but it seems to me much more complicated than just running Linux virtualized inside a VM, like Xen. - @RedGrittyBrick I'm not trying to bridge two separate networks, I'm trying to access two seperate netowrks that use the same IP block.

I found two jails equivalents for Linux that do network isolation, it seems they'll do trick:

  • Linux-VServer: http://linux-vserver.org/Welcome_to_Lin

  • LXC: http://lxc.sourceforge.net/


Your question sounds like it's a job for network namespaces (url is related, not official). Using this technology appears to be relatively new as of this writing and I'm finding quite difficult to find concise HOWTOs that would also explain what's actually happening with each command. Googling "ip netns" (with and without quotes) would probably get you best started putting pieces together.