For AI agents: the complete documentation index is available at https://docs.us.ovhcloud.com/en/llms.txt, the full documentation bundle is available at https://docs.us.ovhcloud.com/en/llms-full.txt, and this page is available as Markdown at https://docs.us.ovhcloud.com/en/hosted-private-cloud/vmware/nsx-configure-loadbalancing.md.
  • English

Load Balancing Configuration in NSX

View as Markdown

Objective

NSX allows load balancing on a level 4 (TCP or UDP) layer or level 7 (HTTP or HTTPS) layer.

Learn how to set up load balancing in NSX.

Requirements

Instructions

We will :

  • Enable Load Balancing on the gateway ovh-T1-gw.
  • Create a server pool from two virtual machines that use a web server running on port 80.
  • Add a virtual server in the Load Balancer configuration which contains our server pool.
  • Set a NAT rule to redirect to the virtual server.

Creating the tag on both virtual machines.

To simplify the administration of the Load Balancer, we will use a tag on the two virtual machines in the future server pool.

In the NSX interface go to the Inventory tab and click on Virtual Machines on the left.

  • Then click on the three vertical dots to the left of the first virtual machine.
  • Choose Edit from the menu.

Load balancing - NSX configure load balancing - step 1

 

Replace Tag with loadbl, then click Add Item(s) loadbl below.

Load balancing - NSX configure load balancing - step 2

 

Change Scope to nginx, then click Add Item(s) nginx below.

Load balancing - NSX configure load balancing - step 3

 

Click the + sign next to your tag to add it to your virtual machine.

Load balancing - NSX configure load balancing - step 4

 

When the tag appears, click SAVE.

Load balancing - NSX configure load balancing - step 5

 

Click the three vertical dots to the left of the second virtual machine and choose Edit from the menu.

Load balancing - NSX configure load balancing - step 6

 

Replace Tag with load and select the Tag: loadbl Scope: nginx from the list below.

Load balancing - NSX configure load balancing - step 7

 

Click the + sign next to your tag to add it to your second virtual machine.

Load balancing - NSX configure load balancing - step 8

 

Click SAVE to add the tag to your virtual machine.

Load balancing - NSX configure load balancing - step 9

 

Stay on Inventory, click Tags and click on the number to the right of the marker you created.

Load balancing - NSX configure load balancing - step 10

 

You can see your two virtual machines using the same tag. Click CLOSE when done.

Load balancing - NSX configure load balancing - step 11

Add group with created tag

Select Groups on the left and click ADD GROUP.

Load balancing - NSX configure load balancing - step 12

 

Enter nginx-server below Name and click SET under Compute Members.

Load balancing - NSX configure load balancing - step 13

 

Click + ADD CRITERION.

Load balancing - NSX configure load balancing - step 14

 

Keep Virtual Machine Tag Equals and select your loadbl tag with its nginx scope and click APPLY.

Load balancing - NSX configure load balancing - step 15

 

Click SAVE.

Load balancing - NSX configure load balancing - step 16

 

Click View Members to the right of the group.

Load balancing - NSX configure load balancing - step 17

 

The list of virtual machines is automatically added to the group based on the criteria in your tag.

Load balancing - NSX configure load balancing - step 18

Activating the Load Balancer

Go to the Networking tab.

  • In the Network Services section on the left, click on Load Balancing.
  • Go to the Load Balancers tab.
  • Click ADD LOAD BALANCER.

Load balancing - NSX configure load balancing - step 19

 

Enter loadbalancer-on-t1 below Name, select ovh-T1-gw under Attachment and click SAVE.

Load balancing - NSX configure load balancing - step 20

 

Click NO.

Load balancing - NSX configure load balancing - step 21

 

The Load Balancer is created and activated on the ovh-T1-gw gateway.

Load balancing - NSX configure load balancing - step 22

Server pool creation

Go to the Server Pools tab and click ADD SERVER POOL.

Load balancing - NSX configure load balancing - step 23

 

Enter sp-nginx below Name and click Select Members under Members/Group.

Load balancing - NSX configure load balancing - step 24

 

Click Select a group and choose the nginx-servers group you created then click APPLY.

Load balancing - NSX configure load balancing - step 25

 

Click SAVE to apply your changes.

Load balancing - NSX configure load balancing - step 26

 

Your server pool is created with your two virtual machines that are members of the group.

Load balancing - NSX configure load balancing - step 27

Virtual server creation

Your server pool is created with your two virtual machines which are members of the group. Go to the Virtual Servers tab and click on ADD VIRTUAL SERVER.

Load balancing - NSX configure load balancing - step 28

 

Select L4 TCP.

Load balancing - NSX configure load balancing - step 29

Fill in this information :

  • Name : Name of your virtual server vs-nginx.
  • IP Address: Front-end IP address of your virtual server on the same network as your NGINX virtual machines 192.168.102.3.
  • Port : Port 80.
  • Load Balancer: Your load balancer loadbalancer-on-t1.
  • Server Pool: Your server pool sp-nginx.

Then click SAVE.

Load balancing - NSX configure load balancing - step 30

Your virtual server is active. If you connect from a machine that uses a segment on a gateway of type Tier-1 Gateways with this URL http://192.168.102.3, the Load Balancer will connect to one of the two virtual machines configured in your group.

Adding a NAT rule

Go to NAT in the Network Services section on the left and click ADD NAT RULE.

Load balancing - NSX configure load balancing - step 31

Enter to-lb-virtual-server in your rule Name with these options :

  • Action : DNAT.
  • Destination IP : A virtual IP address of your T0 such as 198.51.100.1.
  • Translated IP : IP address of your virtual server 192.168.102.103.
  • Service PORT : Choose the predefined port HTTP| 80.

Then click SAVE.

Load balancing - NSX configure load balancing - step 32

 

Your rule is active. If you click on http://virtual-ip-address-on-T0 you will be connected to your virtual server which will redirect the flow to one of the servers in your group.

Load balancing - NSX configure load balancing - step 33

Conclusion

Having read this guide, you should be able to enable Load Balancing, create a server pool from two virtual machines, add a virtual server in the Load Balancer configuration, and set a NAT rule to redirect to the virtual server.