You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!

Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.

If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.

Having a problem logging in? Please visit this page to clear all LQ-related cookies.

Introduction to Linux - A Hands on Guide

This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.

Noticing that I wasn't the only person wanting to take advantage of multiple IP gateways on my system, I thought I'd post our findings. This is the result of many headaches on the part of myself and my colleague Mr. Mirotchnick.

Our equipment--and this Answer--are arranged thusly:
- 2 Cisco DSL modems each connected to separate ISPs, First_ISP and Second_ISP
- A Cisco 24-port unmanaged switch, though any switch or no switch at all will do.
- A RHEL9 linux box (kernel 2.6.5-1.358) but any Linux above kernel 2.6 should be OK.

There is no reason you need the switch in your setup though, since you can just as easily have PCI DSL modems in your gateway or have external modems connect directly to your NICs; our office setup, however, requires it for reasons not relevant here.

If you have directly-connected modems you will need to adjust the numbers here to reflect that, since a directly-connected DSL modem won't have a LAN IP address--you would have to replace 192.168.0.1 and 192.168.1.1 by their WAN equivalents. To keep the Tylenol bill down, you would also need static IP addressing from your ISP ;)

The Commands
The two Cisco modems have LAN ip addresses of 192.168.0.1 and 192.168.1.1 and subnet masks of 255.255.255.0. The two (Linux gateway) ethernet interfaces are configured thusly:

I recommend using two physical interfaces instead of interface aliases for two reasons. Firstly, you have the redundancy of having two devices, so if one of your NICs gets fried you won't lose your connection. Secondly, in our situation, we could not get device aliases to bind properly for routing.

This last bit of network magic is the keystone of this setup; it directs the kernel to use the routing tables in a round-robin, each with a certain weight (preference) that you can alter to prefer one route (i.e., ISP) over the other. You can also reduce the weight to 0 if that ISP goes down.

To test, traceroute two different domains (IPs)--you should see them going out the different interfaces. However. since routes are cached by the kernel, when you test it you will see that, for a short period (the route caching period) a domain will use the same route. This is normal; once the route cache expires it will be free to use whichever route is next in the round-robin.

What this will do
We use this type of multiplexing in a wireless ISP environment to break up traffic of our users across multiple lines both for redundancy and for bandwidth conservation. It was never designed to increase transfer speed (beyond what is not lost by having all our users on a single line).

What this will not do
This type of spanning will not aggregate bandwidth for a single user. By this I mean that if you have two 5 meg DSLs you won't magically have a single 10 meg connection. This is because it routes destination IPs via one of the two ISP connections, so if you're downloading a single file from freshmeat.com all requests for freshmeat.com will go in and out one of the two interfaces (until the kernel's routing cache expires). It will not try to open two connections to the IP using both lines at the same time.

What if one isp goes down? Will the router automatically try the other route when that one fails? Or will users be getting errors half the time until someone MANUALLY sets the weight to 0 for that route?

by Brazen on Wed, 2005-10-19 15:41

I followed the instructions, but if the network service restarts (eg with "service network restart") then the settings are lost!