Manage Learn to apply best practices and optimize your operations.

How (and why) to turn a Linux server into a router

Author Peter Harrison explains why Linux can reduce the cost of routers and how to make that happen.

For more IT articles and tips specific to small and midsized businesses, visit

Most IT managers think routers are overpriced -- that's what Peter Harrison discovered that while he was researching The Linux Quick Fix Notebook, a new book from Prentice Hall PTR. In this tip, Harrison explains why Linux can reduce the cost of routers and how to make that happen. - Editor

The cost of routers continues to decline, but in many cases they are still not cheap enough to be approved quickly by the finance department. There are a number of scenarios where a Linux-based router could be desirable:

  • If a router is needed for a proof-of-concept project, and cost is a prohibitive factor, then an IT manager could consider converting a spare, possibly obsolete, server into a Linux-based router.

  • In some cases the purchase of routing equipment may be in the budget, but staff members want to get some hands-on practice with a cheap router. They could use a Linux router to familiarize themselves with networking concepts ahead of formal training on and the arrival of the intended equipment.

  • Not all equipment can be covered by maintenance contracts when budgets are tight. If an unsupported departmental router fails, and delays are expected in renewing the contract or finding funds to hire a contractor and/or pay for a replacement, then a Linux router could be an option.

  • In some countries, purpose-built routers may be unavailable, prohibitively expensive, or lacking local sales and support representation. In such cases, cheap Linux server-based routers can be a viable alternative.

More advice from Peter Harrison

Comparing security on Linux and Windows

Fixing the lack of Linux documentation

How to integrate and secure Linux

Improving network performance takes teamwork

The previous examples give the impression that a Linux-based router should be considered as a last resort. This is not so. If configured and planned correctly, a Linux-based server converted to a router can be a serious competitor to many small office and departmental routers. Gigahertz server CPUs, plentiful RAM and fast disks can be purchased relatively cheaply. Linux-based routers can increasingly outperform purpose-built routers in the most commonly used tasks. In fact the bi-annual U.S. LinuxWorld Conference frequently showcases many Linux-based routing appliances. The proprietary router manufacturers have recognized this threat and are now increasingly offering all-in-one units that offer routing, switching, firewalls, VPN and VOIP services.

The Linux Quagga application is a case in point. It provides independent daemons that run dynamic routing protocols such as RIP, OSPF and BGP. Each daemon listens on its own separate purpose-built TCP port for telnet logins. Once you log in, the telnet command line virtually mimics a Cisco router. The OSPF telnet session only allows OSPF commands, and the RIP and BGP sessions only allow their respective commands. Commands take effect instantaneously and can be permanently saved in the /etc directory using the familiar Cisco write memory command. This is fun stuff for the techies and eye-opening stuff for their managers.

Routers usually require multiple interfaces across which they pass traffic. Fast Ethernet NICs for Linux are cheap. If you can't get your hands on a spare one, don't worry; the latest versions of Linux all support 802.1q VLAN tagging, which allows you to trunk multiple VLANs from a switch up to s single NIC on your Linux router.

For the least headaches, leave the Linux kernel alone. Streamlining it so as to support only basic system operation and networking functionality will definitely speed things up, but it can take time to determine all the unexpected interdependencies and maximize your optimizations. Give it a try if you have the time and support staff to do it.

Quagga isn't necessary when simple Linux-based static routes will suffice. VLAN tagging is usually only needed when interfaces for multiple networks are in short supply. Kernel tuning can be beyond the expertise of many IT personnel. However, all three should be considered when evaluating a self-built Linux router.

Dig Deeper on Linux servers

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.