Re: [Nolug] Using iproute2 to bond two Internet lines for a webserver.

From: Scott Harney <scotth_at_scottharney.com>
Date: Tue, 08 Apr 2003 15:48:19 -0500
Message-ID: <87istohg18.fsf@zenarcade.local.lan>

Dustin Puryear <dpuryear@usa.net> writes:

> I am relatively new to iproute2. Any information on the topic below
> would save me considerable time. I appreciate any help, thanks.
>
> We want to plug two lines into a webserver to increase the bandwidth
> available to the hosted sites. Rather than use round-robin DNS we
> would prefer to use iproute2 to use equal cost routing across the two
> lines. However, I am still not sure how well that will work. Let's say
> we have a DNS A record for a website:
>
> 100.200.300.400 IN A www.example.com.
>
> Also assume we now have two incoming pipes where our public IP
> addresses are 100.200.300.400 and 1.2.3.4. We then use iproute2 to
> create an equal cost routing rule for use of both interfaces.
>
> So let's consider when a client connects to the website at
> 100.200.300.400. Can we cause the kernel to route our traffic over our
> 1.2.3.4 link instead of 100.200.300.400? That is, can we load-balance
> (or at least load-share) our outgoing traffic? I would think the
> client TCP/IP stack would reject the returned packet as being bogus
> unless we can cause our outgoing packet to spoof the 100.200.300.400
> address.

Me too. unless the kernel does some packet mangling, which would add
latency.

> I do have the process of using iproute2 to define these rules almost
> working. However, one issue is definitely throwing me for a loop. We
> have two IP addresses but our downstream gateway is the same. So I
> have 100.200.300.400 with gateway 6.7.8.9 and 1.2.3.4 with gateway
> 6.7.8.9. (We are allocated two IPs from the same subnet.) So far I
> have:

Yeah. that's odd. in most equal cost outbound configs (in Cisco
anyway) you have two differing gateways. But by specifying interface
names in your route statements, this should work for the outbound
piece. The only other way to do it is with some proprietary bonding
techniques that are done at both ends of the connection (ie your
router and your ISP's router) to make two physical connections work as
one.

> ...
> # setup our routes to our gateways
> ip route add $GW1 src $IP1 dev $IF1
> ip route add $GW2 src $IP2 dev $IF2
>
> # setup interface specific routing tables
> ip route add $NET1/$CIDR1 dev $IF1 table 200
> ip route add default via $GW1 dev $IF1 table $TABLE1
> ip route add $NET2/$CIDR2 dev $IF2 table 100
> ip route add default via $GW2 dev $IF2 table $TABLE2
>
> # create a default route with a multipath route
> ip route add default scope global nexthop via $GW1 \
> nexthop via $GW2
>
> ip rule add from $GW1 table $TABLE1
> ip rule add from $GW2 table $TABLE2
> ...
>
> So here $GW1 == $GW2. How can I define this so that the kernel knows
> to alternate between the two interfaces even though the gateway is the
> same for both?

So how do you know it's not doing what you want already?
Can you do some testing and look at the interface stats on your
iproute2 box?

I would think the initial route statements above would handle the
outbound part of the equation. The only way I can see to control
inbound distribution would be at layer 2 in conjunction with your ISP
or by getting your ISP to distribute the load on their end using equal
cost routes.

-- 
Scott Harney<scotth@scottharney.com>
"...and one script to rule them all."
gpg key fingerprint=7125 0BD3 8EC4 08D7 321D CEE9 F024 7DA6 0BC7 94E5

___________________
Nolug mailing list
nolug@nolug.org

Received on 04/08/03

This archive was generated by hypermail 2.2.0 : 12/19/08 EST