Re: linux routing to multiple providers

From: David Ford (
Date: Wed May 24 2000 - 15:17:44 EST

You need to get the 'ip' utility and I suggest using a recent 2.3 kernel.

In short you'll set up rules to route:

     ip address add brd + dev eth0
     ip address add brd + dev eth1
     ip address add brd + dev eth2

     ip link set eth0 up
     ip link set eth1 up
     ip link set eth2 up

     ip rule add from table 20
     ip rule add from table 21

     ip route add table 20 via src dev eth0
     ip route add table 21 via src dev eth1

You can get iproute2 package from

You do -not- need equal cost multipath because you are making static routes
based on the source address.

In the above example, traffic from the first 128 IPs will go via eth0, the top
128 will go via eth1.


Rob Hill wrote:

> I have a client that has dedicated Internet access via a T1 link. There is a
> provider in their building as well connectivity at a much cheaper rate. I'll
> refer to the current ISP as 'ISP1' and the up and coming competitor as 'ISP2
> '. My client would like to save money on Internet connectivity but only if
> the service is comparable. What they would like to do now is allow some of
> the users to stay with ISP1 and some of the users to stay with ISP2. To make
> my job more interesting, they would like this to be handled by my firewall.
> My firewall is Slackware 7 Linux running kernel 2.2.14 with the latest
> version of ipchains. All of the internal machines have non-routable ip
> addresses so I am using ip masquerading to give them internet access. This
> is working perfectly.
> I have a friend who is very good with Linux and we were discussing this
> scenario several months ago and he claims to have done it using kernel
> features - which he probably has. My friend has since disappeared and so I
> am presenting this to the Linux community for assistance. Now let's say I
> put another network card in my firewall and I get my connection for ISP2 and
> run it into that NIC. How would I make both interfaces accessible from the
> Internet? Normally I only have one default gateway, but here I would have
> two. Also, how could I specify what machines internally would use ISP1 and
> which ones would use ISP2?
> To see this post with some diagrams, go to
> Thanks,
> Rob Hill
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to
> Please read the FAQ at

-- \\\\\|||||| &%&%&%& 99 little bugs in the code, 99 bugs in the code, @|~|'
|o> @|& fix one bug, compile it again... | \\__/ | /, |& 101 little bugs in the
code.... \ / -' ,

-- |--HUGS---

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

This archive was generated by hypermail 2b29 : Wed May 31 2000 - 21:00:12 EST