Gateway/Router – Multiple Public IPs on Virtual WAN Interfaces Through Single WAN Interface/Port

networkingroutingvirtualizationwide-area-network

I am looking to setup a router with multiple public WAN/IP interfaces that can be routed across a single physical WAN interface/port. I realize it would be necessary to have different MAC addresses on each interface for full layer 2 compatibility, but this could be achieved via MAC cloning, randomizing the MAC, or using some sort of virtual MAC assigning (Similar to VMware Virtual LANs and Interfaces).

I'm pretty sure this is possible, as I've seen very similar setups for server environments with Linux network configs and only using a single physical NIC, but can anyone confirm this is possible or have a solution or basic explanation of why or why not this might work?

If so, is it possible with something like DD-WRT specifically? This is what I'm currently running on my Asus RT-N66U. OpenWRT seems much more similar to traditional Linux network configuration, but unfortunately isn't supported on my router. DD-WRT however works great, but network configuration is done through NVRAM variables – which isn't documented well, especially with network configuration specifically and interfacing.

I eventually will have some IPTables configuration to route separate subnets(maybe VLANs, but I would prefer to keep everything open and accessible, but limited to specific subnets) to each individual WAN interface.

What I don't want to have to do is configure multiple LAN ports to be used as WAN ports and setup a "dual" WAN connection and then just bridge them physically with a switch to connect to my single physical WAN connection to my ISP.

Here's a good example of what I'm looking to do, just with an actual network router rather than a server with a single NIC.

Edit:

ISP provides internet via RADIUS/MAC authenticated DHCP connections. They also provide static IP blocks. Both options are available to me and work in any configuration. My main question here is how to setup virtual interfaces with a router. Preferably with DD-WRT, as that's what I'm currently using

Best Answer

This is not only possible, but also common. My preferred method is to employ some sort of hypervisor to host discrete units of function each within their own virtual machine. Using this sort of technology will allow you to provision the ideal configurations in virtualized resources as well as keeping them somewhat isolated from each other. For example, you could very easily have a machine with a single physical NIC that hosts a gateway device that has been endowed with as many virtual nics as is convenient for your application.

As a testament to how easy this is, I happen to use Xen on a Intel Atom "netbook"-type computer to host a half-dozen individual VM's that provide network services at home. I know SF doesn't like to hear about home solutions--I only offer this as an anecdote, Xen is a mature production-ready hypervisor and I promise you that it is up to this task. This one physical NIC masquerades as many different devices and it also does VLAN tagging where appropriate.

If you want something a little lighter weight, you can also provision "macvlan" interfaces in Linux, but I've found the documentation to be hard to come by. I've made it work, but it was a lot more messy than going with Xen and provisioning VM's that behave as if they have many interfaces (or whatever hypervisor you may prefer because vmware is just as capable on the right hardware. I used Xen with the Atom CPU, but I've done the same with vmware with hardware that was more purpose-built for virtualization).

Related Topic