NIC bonding with two uplinks

8,648

Solution 1

Bonding is not applicable for this case.

For your solution: You will find some useful notes at Increasing bandwidth with multiple NICs.

For Bonding: You can start at the Wikipedia Link Aggregation and related Channel bonding pages for initial reading on bonding.

Solution 2

"Bonding" (teaming, trunking, or a host of other terms) NICs is used to increase bandwidth into a switch, or for redundancy for LAN connections.

Redundancy and/or bandwidth expansion for WAN connections (like, to the Internet) is accomplished with routing protocols (typically BGP). Bonding the NICs together on a server computer isn't going to accomplish that.

Solution 3

No, you cannot handle multiple ISP uplinks using bonding. Bonding is strictly a Layer 2 (Ethernet) technique, and has no way to detect upstream failures or properly split traffic beyond the direct Ethernet link to your upstream switch/router.

Linux can support multiple upstream ISPs, in either a load-balancing (with limits) or redundant configuration (or both), using policy-based IP routing with multiple routing tables. There is an excellent explanation of the theory and practice, with diagrams, here:

However, I would not recommend implementing that tutorial in a production environment. It's pretty raw, and it will break your existing distribution-specific IP configuration (network-scripts, etc.), and it doesn't handle upstream failures automatically.

The Shorewall project (http://www.shorewall.net/) provides a wrapper mechanism that is far easier and more manageable, especially if you're not already a policy routing pro. It calls itself a "firewall", but it can be strictly useful as a load-balancing, failover-handling gateway to multiple ISPs. The project has a tutorial page that outlines some of the details, here:

Shorewall integrates nicely with the most popular Linux distros, and has actively-maintained packages for RHEL/CentOS, Fedora, Debian, and OpenSUSE.

Specifically, Shorewall provides a set of simplified, rule-based configuration files that you can edit as needed to describe your configuration and implement your desired functionality. It has lots of examples to copy, too.

Share:
8,648

Related videos on Youtube

Karolis T.
Author by

Karolis T.

Live long and prosper.

Updated on September 17, 2022

Comments

  • Karolis T.
    Karolis T. almost 2 years

    Is bonding the preferred way of implementing ISP redundancy?

    In the texts I've seen, bond device has a netmask, gateway of it's own. How can this be obtained if there are two different gateways from two uplinks, which one to choose?

    Do I need any special routing rules to go with it or does simply configuring separate interfaces (using Debian, /etc/network/interfaces), i.e eth1, eth2 for their corresponding uplinks and bonding them to bond0 handle routing automatically?

    If I want to NAT client machines, do they use bond device's IP as a gateway? Does the bond0 device is the device that goes into iptables nat rules?

    Thanks

    • Kevin Kuphal
      Kevin Kuphal about 15 years
      I cannot comment on the specifics of how to load balance two ISPs using Linux, but bonding is not the proper terminology. You do not make the two ISP connections appear as one as you would an uplink to a switch. You typically achieve ISP redundancy using simple fail-over configurations, or load-balancing using round-robin or BGP routing configurations.
  • Nic
    Nic about 14 years
    Just thought of something else - when you bond across the internet, the ISP that hosts the bonding platform will have to use much more bandwidth than if they bonded it over their own lines. This is because any connections originating outside of their network will obviously take bandwidth on the way in as well as then on the way out with IP transit. So make sure you discuss bandwidth limits and amounts, as some will undoubtedly charge a lot for extra transfer if you exceed those limits.