Creating a Low Resource Linux Router

Creating a Low Resource Linux Router

I know several people who have set up personal lab environments to either use in their careers or to learn new technologies. More often than not it is a good idea to have multiple subnets in the lab to simulate real-world conditions. I was looking for a way to create the lowest resource router I could for my lab. Being a Linux user I decided that I would try to create a router using Debian Linux.

I know that there are other ways to create a Linux router, but I figured I would post something on how I built the routers in the virtual lab environments on my laptop (using Oracle’s VirtualBox) and my home lab (using vmWare Vsphere 5.1). It was interesting to me to learn something different rather than just setting up a canned solution.

Both Linux routers are using 64MB of RAM and about 1GB of disk space. I like having the infrastructure use minimal resources, leaving more for the “real” machines.

Get the network install from www.debian.org. Install it using the defaults except desktop environment. You don’t need a UI for this.

When you build the VM, connect all of the NICs for the different subnets you want to use. Also, use at least 512MB of RAM during the installation. We’ll change this later, but for now you want to get the install completed. Once the installation is done you can set up the routing configuration on the VM

I know you can use vi to do all of the editing, but I chose to write this up using nano as the example. Also, keep in mind, Linux is case sensitive. The command “Nano” is not the same as the command “nano”.

Edit the /etc/network/interfaces file (“nano /etc/network/interfaces”). The eth0 interface should be populated, but you’ll have to add the others. Add the auto eth# lines and the iface eth# inet static sections as shown below. Note that the IP addresses are all static.

Next, edit the /etc/init.d/networking file (“nano /etc/init.d/networking”). Using the arrow keys, scroll down to the bottom of the file and add echo 1 > /proc/sys/net/ipv4/ip_forward to the end of the file before the exit statement.

Shutdown the virtual machine, change the memory to 64MB, boot it up, and you now have a Linux router that uses minimal memory. I tried to use 32MB of memory, but the machine will not boot with less than 64MB.