Saturday, October 25, 2014

Enable load balancing on Windows 7 with 2 or more NICs

Load balancing is a process through which network loads are split between multiple Network Interface Cards based on different algorithms. This is done at the transport level so each connection/session is treated individually before deciding it's path. This means that a single connection can't be split during this process, and only multiple connections can be separated.
For instance, if you open a YouTube video in your browser, that's one connection, and can't be split. But if you open 2 YouTube videos, or simply any 2 websites in your browser, that means 2 connections, and that can be separated.
Don't confuse load balancing with network bonding/link aggregation. In network bonding, individual network packets are encapsulated and then are split and sent over multiple paths, through multiple NICs to a service provider. Their server will decapsulate the packets, recover the initial ones and send them to the original destination.
Before Windows 7, load balancing was not really possible on older versions of Windows, except on some server editions. Windows 7 and above seems to balance the traffic if there are 2 or more NICs configured with the same cost metric.
For instance, if you have 2 ISP connections coming through 2 different NICs, and you configure both NICs with the same cost metrics, you can obtain basic load balancing on those interfaces.

So let's assume you have 2 of those Mobile Broadband USB modems (like UMTS/HSDPA/LTE/etc) from your regional mobile network operator, and you would like to use them both at the same time, while you navigate in your browser or you do any other online activities that require multiple network connections (i.e. video stream, downloads, gaming, VoIP, torrents, etc). To do this, you'll have to set the same metric cost for both of your NICs, so that Windows wont make any difference between choosing one path or another.
Each network adapter in Windows 7 and above, has 2 cost metric values automatically assigned to it by the OS, depending on the connection performance: the interface metric and the default gateway metric. The network adapter with the smallest route metric (which is the sum of interface metric and default gateway metric), will have all the traffic, but if multiple network adapters are manually configured with the same route metric, connections will go through whichever has less traffic load.
That being explained, to enable load balancing in Network Manager, all you have to do is click the "Control Panel" button

click "Load Balancing" button in the newly open window

enter the metric values you want to use for all of your network adapters or leave the default ones, and click "OK"

then wait for the configuration process to finish, and if you wish, you can check in Control Panel again to see if the metrics changed successfully.
After enabling load balancing, I did a little test to confirm that it works, and I opened 2 video streams in my browser. As you can see in the picture below, the first one goes through the "MAC Bridge Miniport", and a bit later, the second video stream goes through "802.11 USB Wireless LAN Card #2".

Note: Sometimes, even though you have 2 interfaces configured with the same cost metric, Windows 7 will still prefer one of the two interfaces, and it will only use that one.
To workaround this, usually disabling the interface that Windows 7 prefers from Network and Sharing Center, to force traffic through the other interface, and then re-enable it back, will do. It can be frustrating sometimes.

If you have an older version of Windows than WIndows 7 or the load balancing feature doesn't do a very good job for you, you can manually create routes to split the traffic between NICs. For instructions on how to do that, check the next tutorial: Route and separate connections through different NICs.