How I came to virtualize my router

A year or two ago, I took it upon myself to reverse the trend of computer proliferation in my life. I offloaded the free support that I used to provide to my friends to other knowledgeable friends, I got rid of many machines that were just sitting there for the looks (they were running Folding@Home) and finally centralized all my activities on one laptop instead of having both a desktop for power and a laptop for mobility.

All was great, and the return in time was direct and fast. The amount of effort invested every month maintaining hardware and software went down dramatically. I once read that you need one technician per 50 machines, which makes sense if the people using computers are not so savvy. But you sometimes still need a few machines, be it for testing, running platform dependent software, or just fooling around with another OS. For that problem I found virtualization to be the solution. While it will spawn a host of new difficulties, it does cut down on the hardware woes and once you tame it, it shows lots of potential; so much that in the process of making physical machine virtual, I had the idea of applying the same philosophy to that grey and blue Linksys box that breaks from time to time and requires its fair share of maintenance and configuration.

So there I am with a router that does not exist physically. Friends come to my place and look for the device to hook their laptop to (no wireless for now), but they get directed to my lab machine. They then give me an “are you sure?” look, but hook the cable anyway, and then proceed to using internet, charmed by the “magic black box” phenomena.

Making a router virtual, while not so trivial, does have a few advantages:

  • One less computer if you use a machine that is on anyway (lab computer in my case).
  • You get to use better routers like Smoothwall, m0n0wall or Fresco without a standalone computer.
  • Less power consumption.
  • You can backup your router.
  • Essentially free
  • It is a fun project.

The setup is actually quite simple, I will not go through the whole process command by command (I’ll keep that for later) but here is an overview of what you will need.

  • Time
  • Patience
  • A computer with enough network interfaces.
  • An OS (I use Ubuntu 8.04).
  • A router distro (Smoothwall, m0n0wall, Fresco, etc.)
  • VirtualBox (Or any other emulation/virtualisation software you migh prefer).
  • Bridge Utils or any other bridging software.

And here is what you will do:

  1. Bridge all your network interfaces but leave one outside the bridge, it will be the outside interface. Make sure other programs cannot use it !
  2. Install VirtualBox.
  3. Map you bridge and outside network interface with virtual interfaces on VirtualBox.
  4. Virtualize the router distro on VirtualBox
  5. Configure the router like is was a real one.
  6. Unplug your old router, put it back in its box and keep it just in case…
  7. Admire your work.

As for wireless support, I do not yet possess a wireless adapter that is compatible with madwifi and can be used in master mode; it is on the way. However, I am unsure whether I will be able to bridge to it or not as I have come across many forums posts of people trying without success. If it is a no go, then maybe making the wireless network a different subnet and routing traffic will do the trick…

Leave a Reply

Your email address will not be published. Required fields are marked *