Re: linux routing to multiple providers

From: David Ford (david@kalifornia.com)
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 1.2.3.4/24 brd + dev eth0
     ip address add 5.6.7.8/24 brd + dev eth1
     ip address add 192.68.1.0/24 brd + dev eth2

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

     ip rule add from 192.168.1.0/25 table 20
     ip rule add from 192.168.1.128/25 table 21

     ip route add table 20 via 10.0.0.1 src 1.2.3.4 dev eth0
     ip route add table 21 via 10.9.9.1 src 5.6.7.8 dev eth1

You can get iproute2 package from ftp://ftp.inr.ac.ru/ip-routing/.

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.

-d

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
> http://www.thisbox.com/~rhill/posts/LinuxPost-052400.htm
>
> Thanks,
> Rob Hill
> rhill@thisbox.com
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.rutgers.edu
> Please read the FAQ at http://www.tux.org/lkml/

-- \\\\\|||||| &%&%&%& 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 majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



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