FreeBSD load splitting and failover with 2 WANs (dynamic routing)

failoverfreebsdrouting

I have a freebsd server (ipfw, dhcp, dns) with one LAN interface and 2 WAN interfaces (2 different ADSL lines).

The WAN interfaces (re0 and re1) are aggregated into one lagg0 failover (ifconfig_lagg0="laggproto failover laggport re0 laggport re1").

What I would like to use is routing traffic directed to some nets to re1, failing over to re0 when re1 link goes down, but still use re0 and failover to re1 by default.

Is it possible?

Thanks.

[UPDATE]

Ok, so bonding is not a possible solution (and now I see that it was obvious).

How can I automatically update the routing on the gateway when the link on one of the lines goes down?
I don't care if I need to switch from ipfw to pf (I was planning the switch anyway).

Thanks again.

Best Answer

This is NOT possible, given only the configuration you've described. Link aggregation (or "bonding", as it's sometimes called) cannot provide load balancing or failover between multiple upstream providers. Your current configuration does not appear to serve any useful purpose, unless you are leaving out some important routing and/or IP configuration details.

Link aggregation is strictly a layer 2 (Ethernet) protocol. It can provide load balancing and/or failover when you have multiple physical Ethernet links to a single upstream switch or host. But two different DSL uplinks (even if they link to the same provider) are two different devices. Bonding multiple DSL lines is possible, and so is bonding multiple T1 lines, if the router/bridge devices that terminate the telco loops (i.e., the DSL box you plug into your phone line) support the same protocol-specific (e.g., T1, DSL, etc.) bonding technique.

Your FreeBSD host cannot bond multiple DSL links unless you install DSL cards in it that offer that feature. And even then, your ISP would have to support bonding at their DSLAM (the equipment at the other end of your DSL lines, in the phone company CO).

Load balancing and/or failover of IP traffic, using multiple upstream links, MUST be handled with routing techniques (Layer 3, IP).

To be fair, I may have assumed too much about the details you left out. Could you update your question with some more information about your configuration?

  • What IP addresses are bound to re0, re1, and/or lagg0?
  • Have you configured a single upstream gateway route, or are you using a more complex routing setup (dynamic routing daemons, IP forwarding/header rewriting, source IP-based routing rules, etc.)?
  • If you're using a complex routing setup, could you describe it in detail?
  • Do your two DSL phone lines terminate in a single device (AKA modem, router, bridge, etc.), or does each DSL line have its own box? If the two lines share one box, do you have both re0 and re1 plugged directly into that box?
  • Do your DSL lines come from the same ISP? If so, does your ISP support DSL bonding? If so, is your current service plan set up for bonding? (i.e., did you order bonded DSL lines, and have they set you up for bonding?)