Home > Blogs > VMware vSphere Blog


Configuring vCloud Director 5.1 with the vCNS Load Balancer

Many networking enhancements have been made available with the release of vCloud Director 5.1 using vCNS 5.1 (vCloud Networking and Security) and vSphere 5.1. There have been inquiries and activity around some of the new features and how to configure them; load balancing being one of them. If you have more than one VM as part of a pool and want incoming traffic to be balanced between them, this is a key feature included with your product.

Today, I’m going to walk you through one way to configure Load Balancer services on an Edge Gateway in vCloud Director. Many of the vCNS concepts and features are explained in Ranga’s post here, Load Balancing with vCNS, but I’m going to point out a few key points to pay attention to. This article takes you straight into the vCloud Director web portal in order to configure everything as a vCloud Director Administrator.

To see how this can be configured in your cloud environment, continue reading…

Take note that not every screen shot for the entire configuration is presented in this article. I tried to keep it short and clean with only critical screens shown.

First, ensure you have your cloud configured with an external network. Shown here, I have an external network with an IP pool of 192.168.66.20-39:

Create an Edge Gateway assigned to your Organization vDC that maps this External Network to an Organization Network.

Finally, create an Organization vDC Network and map it to the Edge Gateway. As shown here, I have created a routed network with an internal-facing pool of IP addresses ranging from 192.168.77.50-100:

I created a vApp with two server virtual machines and attached them to this Org vDC Network. The first server has an IP of 192.168.77.50 and the second server has an IP of 192.168.77.51. Take note of the assigned IP addresses as later you’ll see how these IP addresses are used in the load balancer services configuration.

Next, right-click on the Edge Gateway and click “Properties” to sub-allocate an IP pool on the Edge Gateway. These IP addresses can be used as load balancer IPs for your Load Balancer services later on; this range of IP addresses is a sub-allocation of the external network’s IP pool created earlier (this sub pool uses the IP range of 192.168.66.35-39 from the 192.168.66.20-39 pool above):

From here, after clicking “Ok,” right-click the Edge Gateway again and select “Edge Gateway Services…”

Select the Load Balancing tab and add a pool of servers. Input a name and description, then configure the services. When selecting the “Balancing Method,” keep the following information in mind:

IP_HASH: Selects a server based on a hash of the source IP address of each packet.

LEAST_CONN: New connections are sent to the server with the fewest connections.

ROUND_ROBIN: Each server is used in turn according to the weight assigned to it.

URI: The left part of the URI (before the question mark) is hashed and divided by the total weight of the running servers. The result designates which server will receive the request. Applicable to only HTTP service load balancing.

Select the services and enter the appropriate port(s) you wish to load balance. Configure the monitoring service ports under the “Health Check” configuration page. Select the proper Health Check Modes and Parameters.

Next, add back-end server members to this pool. As noted above, enter the IP address(es) for the member servers in your vApp(s). Keep in mind the Ratio Weight will specify how requests are proportionately routed to members in comparison to other member weights in the pool:

Review your work and click “Finish” when complete:

Following the Pool Servers creation, now a Virtual Server needs to be created and assigned. Select the “Virtual Servers” button and click Add. Enter a name for the virtual server (this will need to match what you enter into DNS for this IP address, too, if you want to reach it by name) and select the network (the external network we referenced earlier). The IP Address is manually entered, but needs to be a part of the sub-allocated IP pool we created earlier. In this example, 192.168.66.35 is selected:

Configure the Port, Persistence Method, Cookie Name, and Cookie Mode values as required. Enable the Virtual Server and click Ok. Please note that your pool server will show a status of down if there are no member servers available to receive traffic on the ports selected.

Finally, create firewall rules on this Edge Gateway in order to allow the desired traffic through the firewall. Select the Firewall tab under the “Edge Gateway Services…” menu item if you aren’t still on this screen. “Add…” a rule for each of the services you wish to allow through the firewall. In this example, a rule is being configured for the HTTP port:

Note in the image above the source is “external” and the destination is the IP address of the load balanced virtual server we created previously. Set the rule to “Allow,” and log traffic if you wish.

The configuration can be tested by access the virtual IP address (through a web browser in this example) and determining which web server you have reached. If the services are configured in a round robin manner, a second attempt will send you to the second member server in the pool.

This completes the configuration of load balancing services in your vCloud Director environment. For those that haven’t yet upgraded to the latest version of the suite, these services were available in previous versions, but through API. Also, the API can still be used in the latest version for those that despise working with GUI’s or wish to automate some creation and deployment of these services and features.

 

Get notification of new blog postings and more by following Harry on Twitter: @HarrySiii

This entry was posted in vCloud Director and tagged , , , on by .
Harry Smith

About Harry Smith

Harry Smith is a Senior Technical Marketing Manager in the SDDC Technical Marketing group at VMware. Harry currently focuses on the Software-Defined Datacenter infrastructure, including the vCloud Suite and other products that may go along with it. Previous to Technical Marketing, Harry worked within the VMware Professional Services Organization. His main focus was vCloud Director (and Lab Manager) private clouds, especially SDLC (Test/Dev) in the cloud. He has a long history with vCloud/vSphere Architecture Design, as well as concentrating on business, people, and process to assist in the adoption of virtualization strategies to align with business goals. Get notification of new blog postings and more by following Harry on Twitter: @HarrySiii

13 thoughts on “Configuring vCloud Director 5.1 with the vCNS Load Balancer

  1. Billy Lucas

    I have added a simple load balancer config. However when I look at my pool status, it shows a red “x” for status, even though load balancing is working. Tested by using simple html to create an index file denoting “web server 1″ and “2″ respectively. Any ideas? Maybe I’m forgetting something.

    1. Harry SmithHarry Smith Post author

      Hi Billy! Apologize for not seeing this sooner. Did you notice if time also fixed your red “x” status? I’m looking into this to see if you may have missed something along the way anyway.

  2. Burke Azbill

    Nice tutorial Harry! This is just what I needed to step me through the process. I now have a pair of simple web servers sitting behind my gateway being loadbalanced using the method outlined above. Now I get to break it and Orchestrate it.
    Once the manual process is defined and understood, Orchestration can take place… Working on vCO Package now ;)

    1. Harry SmithHarry Smith Post author

      Thanks, Burke. I’m very glad you found it useful and I love that you’re building a workflow around it. ;-) I can think of many customers that would take advantage of that!

  3. Reza

    Hello,

    Thank you for a well put together article. I’m wondering which Load Balancing method is best for a web application that needs to maintain user state. Would that be IP HASH? Or will it not matter if you use the Virtual Server’s Persistence options?

    1. Harry SmithHarry Smith Post author

      Hi Reza,

      Well, as a coworker best said:

      “It depends !!!

      If you want web servers to be evenly loaded based on number of session, you can use Round robin.

      If you know that there is enough variation in Source IP and port number (different clients connecting to web application), IP hash will also provide good load balancing.”

      Hope this helps!

      ~harry

  4. Ashley Cotter

    Are you sure that you define the source port the same as the destination…

    As you would usually connect to a webserver on port 80 but the session would be sourced on a HIGH random port

    example netstat -a from my machine

    TCP 10.159.67.6:59337 2.18.179.51:http ESTABLISHED
    TCP 10.159.67.6:59338 2.18.179.51:http ESTABLISHED
    TCP 10.159.67.6:59339 2.18.179.51:http ESTABLISHED

    as you can see I am sourcing on a HIGH RANDOM and connecting on PORT 80 to my peer..

    forgive me of I am wrong

  5. Pingback: VCAP-CIA Study Material and Blue Print | VirtualizationExpress

Comments are closed.