VMware NSX integrates networking into the virtual world. It also brings networking services to the in a distributed and much simpler fashion. One of those network services is load balancing. Using NSX, you can create virtual IP addresses which routes incoming network traffic to multiple real servers.

It works just like your regular hardware load balancer (F5, A10 Networks, etc), but in a distributed way and grouped by real servers on your computing hardware.

Making these network services virtual, means being able to deploy it very rapidly and easy. So easy, you can create a web load balancing cluster in like 5 minutes. To demonstrate how easy, I’ll go through the steps below. In this example, the base NSX components (manager, controllers, edge appliance) are present, as I used the VMware HOL. I used the following details:

– Virtual IP: 192.168.100.5
– Type: HTTP, Port 80
– Real Servers: 10.1.30.10, 10.1.30.11
– Connection limit: 150 total, 15 per second

To begin, we need to manifest the virtual IP address on the edge appliance. You can do this on the edge interface settings page. Get there through the vCenter Web Client -> Networking & Security -> Your perimeter appliance -> Settings -> Interfaces:

1-nsx-lb-perim-add-interface

Select the interface the virtual IP address will be added and edit that interface, then edit the subnet you want to add it to:

2-nsx-lb-perim-add-interface-ip

Then add the new virtual IP address to the subnet: 

3-nsx-lb-perim-add-interface-ip-2

When that is done, the virtual IP will be activated on the edge appliance. Now on to the load balancing. A load balancing service in NSX comprises out of x things: Application Profiles (basic app settings), Service Monitor (monitors the state of a real server), a Pool of Real Servers and a Virtual Server.

Let’s begin by creating an Application Profile. The Application Profile contains the basic settings of the application being load balanced; is it a HTTP, HTTPS or TCP application, do the sessions need to be persistent, do you want a X-Forwarded-For header added and if it’s an HTTPS application, what certificate should we use? 

4-nsx-lb-add-app-profile

Next we add a Service Monitor. It is here you define what makes the real server be ‘alive’. You can do so by using a GET or a POST on a specific URL and expect certain results. Also specify a monitor interval and the timeout.

5-nsx-lb-add-app-monitor

With the Application Profile and Service Monitor in place, you can add a Pool of servers. Create a new Pool, give it a name, select the load balancing algorithm and Service Monitor and add a Member: 

6-nsx-lb-add-pool-member 7-nsx-lb-add-pool

After adding your Server Pool, all that is left is adding a Virtual Server using the Virtual IP we added to the Edge appliance earlier. Click to add the Virtual Server, give it a name, enter the virtual IP address, select the protocol used, select the server pool and application profile. You can also enter a connection limit and rate limit:

8-nsx-lb-add-virtual-server 9-nsx-lb-add-virtual-server-progress

Congratulations, you now have a working load balancing service! Verify by selecting the Virtual Server details and, of course, browsing to your web service. 

10-nsx-lb-add-virtual-server-done 11-nsx-lb-web1 Hit refresh and recheck: 12-nsx-lb-web2


Share the wealth!