Switch – If two NICs are bonded and connected to different switches how does a router decide which switch to forward the packets to

ethernetipv4routerswitch

I am trying to understand how the architecture works in case of NIC Bonding. The scenario is: There are 2 NICs on the same system. Both are bonded to support failover and load balancing. Hence the IP of the bond driver(virtual) is the IP to which traffic comes when target to any of the NICs. Each NIC is connected to a different switch. Now because these NIC are bonded the switches will have the same IP address pointing to different MAC address. So how will a router decide which switch to forward an incoming request to which is intended for that IP? Will there be 2 entries in the routing table for the same IP address? Will the router broadcast to all switches? Will there be more than one router?

Best Answer

It depends on how the interfaces are bonded.

One way to do this is that only one NIC is really active. If one of the links goes down, then the other NIC starts using the MAC address of the first NIC, or the system issues a gratuitous ARP with its MAC address to get everyone to update their ARP tables.

A close second to this method is that both NICs are used to send, but only one is used to receive.

Any other configuration requires the cooperation of the switches or the sending parties.

Note that unless the switch and the end device agree on a configuration, you could get some bad behavior. For example, the switch might not know which port actually has which MAC and will instead flood ALL traffic for that MAC. Or you could get a non-functional link.


Since you are using Adaptive Load Balancing, I will explain this mode.

Outgoing packets are split based on load.

Incoming packets are a bit trickier. When an ARP request is received, the MAC sent back is based on the requester's IP address. For example, if client A send an ARP request for your IP, it will get the MAC of NIC 1. Later when client B sends an ARP request, it will get the MAC of NIC 2. That way clients are split among the available NIC's.

Related Topic