[LARTC] Using iproute2 to bond two Internet lines for a webserver.

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

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:

...
# 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?

---
Dustin Puryear <dustin@xxxxxxxxxxxxxx>
Puryear Information Technology
Windows, UNIX, and IT Consulting
http://www.puryear-it.com





[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux