7

I have two ISP at the time, connected to the same machine. I added both of them in the routing table as default. However, only one connection is used.

$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    303    0        0 eth0
0.0.0.0         192.168.0.1     0.0.0.0         UG    303    0        0 eth1
192.168.1.0     0.0.0.0         255.255.255.0   U     303    0        0 eth0
192.168.0.0     0.0.0.0         255.255.255.0   U     303    0        0 eth1

How can I balance the traffic load between the two ISP?

8

The Linux Advanced Routing & Traffic Control HOWTO has a section describing to solve the problem.

The key step to balance traffic between the two routes is to give them both a weight.

ip route add default scope global \
    nexthop via 192.168.0.1 dev eth1 weight 1 \
    nexthop via 192.168.1.1 dev eth0 weight 1
  • The two endpoints of those routes are obviously using NAT. If he balances the traffic between the routes, it will break horribly as each gateway receives traffic for NAT entries it does not know or understand. – David Schwartz Nov 3 '11 at 0:05
  • from what I understand, the routes are cached, requests for e.g. www.google.com will always go through the same endpoint. – bbaja42 Nov 3 '11 at 8:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.