Thursday, November 6, 2014

Windows Network Load Balance, Unicast or Multicast ?

WNLB (Windows Network Load Balance) is a clustering technology offered by Microsoft as part of all Windows 2000 /2003 /2008 /2012 Server family operating systems.
WNLB or NLB for short, is commonly used in small networks and some medium business companies.
It is very easy to be implemented, some clicks and you are ready to go.
Once you open WNLB you can right click on the root console and then connect to an existing cluster or simply create a new one.
If you need to connect to an existing cluster you can simply type the cluster IP and here you go, as long as you have the required permission.
If you want to create a new cluster, you can follow the wizard, its a straightforward process, just add the host IP address or name and write the Virtual IP (VIP) and  you are almost done.
While configuring the cluster, you will be presented with a simple innocent selection.

The Cluster Operation Mode, Unicast, Multicast or IGMP Multicast.

Which one to select?

The answer is depend network topology, each one has its pros and cons, and at then end of this post you will be able to make the right decision (hopefully).

Unicast: Simply and easy way to implement WNLB, it work as the following:
Each WNLB cluster node will replace its real MAC Address with a new MAC address which is generated by WNLB, because of this, WNLB cluster nodes will NOT be able to communicate with each other, as all of them have the same MAC address, so no packet (which is going to the other node) will not even leave the server ( as the destination MAC address is the same as the source MAC address).
So in this case you will need to have two network interface for the cluster to work, one will be for the WNLB Cluster (you can make it the client facing interface) and another interface for the WNLB Nodes communication.
Even when you configure your WNLB to operate in Unicast Mode which have only 1 interface, you will get a warning message telling that this is not recommended.

One other problem you will face when your cluster is operating on unicast mode is,Switch Flooding.
To understand switch flooding you need to know how client and the cluster are communicating.

Lets say we got the following network


The Client Computer need to connect to a web service running the cluster.
The Client will send a ARP request asking for the MAC address for 10.6.0.168.

As the switch and the client don't have the MAC address for this IP , the Switch will send (flood) the packet to all ports.
The Traffic reach one WNLB host, the Cluster Node will reply back using a MASKED MAC.


As you can see from the picture above, the MAC address is masked as MS-NLB-VirtServer_0.
In this case, the switch will never learn on which port is the MAC address for 10.6.0.168.

For every traffic passing for WNLB the switch will flood the traffic to all ports, Why?

Microsoft did this to ensure that all the traffic keep reaching all the cluster nodes, so the Switch will not assign a single interface for the NLB, thus preventing other nodes from sharing the load.

What is the impact?
A lot of unnecessary traffic reaching all other host on the switch and more processing for the switch and the hosts on the switch (As the hosts other than WNLB hosts on the switch will drop all the packet that are not sent to them).

How to Fix?
Use HUB insted of swtich, HUBs will always flood the traffic, or simply isolate the WNLB to a separate VLAN.
And the most advance solution, buy Load Balancer, they will offer a much better way to manage load balance

When to use Unicast?
Unicast is simple to implement, as other WNLB Operation mode may require some hardware configuration modification (or even hardware replacement).

What is the MAC Address for Unicast?
In Layer3: The MAC address for unicast NLB is 02-db-xx-xx-xx-xx, where xx-xx-xx-xx is the IP address of the host
In Layer 2: The MAC Address for Unicast NLB is 02-PP-xx-xx-xx-xx, where PP is the host priority and xx-xx-xx-xx is the host IP Address

Multicast

In multicast mode, NLB assigns a layer-2 multicast address to the cluster adapter instead of changing the adapter’s station address. Multicast allows inter-host communication because it adds a layer two multicast address to the cluster instead of changing it. This makes inter-host communication possible as the hosts retain their original unique MAC addresses and already have unique dedicated IP addresses. However, in multicast mode, the ARP reply sent out by a host in the cluster, in response to an ARP request, maps the clusters Unicast IP Address to its multicast MAC Address. Such a mapping in an ARP reply is rejected by some routers so administrators must add a static ARP entry in the router mapping the Cluster IP Address to its MAC Address.

Multicast is way more better for people using VMWare as VMWare recommend

Cons:
It does not work automatically on all network equiment (ex. Cisco)
Will require to add static ARP entry on the router to be able to connect with the cluster.

Pros:
No Switch flooding
No need for additional NIC on each host

What is the MAC Address for Multicast?
It will start with 03-bf-xx-xx-xx-xx

Recommendation ?
- The highest recommendation is to go for hardware load balance (Kemp - F5 ...).
- Dont go for Unicast, stay with Multicast.
- I faced a very strange problem with RDP that keep disconnecting, once I changed the NLB to Multicast, everything went OK.

This is what going on with Windows Network load Balance.
Hope you like this post, dont forget to support me with some likes :)

Post a Comment