---
title: "Konfiguracja równoważenia obciążenia w NSX (EN)"
description: "Learn how to configure Load Balancing"
url: https://docs.ovhcloud.com/pl/guides/hosted-private-cloud/powered-by-vmware/nsx-configure-loadbalancing
lang: pl
lastUpdated: 2023-02-27
---
# Konfiguracja równoważenia obciążenia w NSX (EN)

## 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**

:::warning
OVHcloud provides services for which you are responsible, with regard to their configuration and management. It is therefore your responsibility to ensure that they work properly.

This guide is designed to assist you as much as possible with common tasks. However, we recommend contacting a [specialist provider](https://partner.ovhcloud.com/pl/directory/) if you experience any difficulties or doubts when it comes to managing, using or setting up a service on a server.

:::

## Requirements

- Being an administrative contact of your [Hosted Private Cloud infrastructure](https://www.ovhcloud.com/pl/enterprise/products/hosted-private-cloud/) to receive login credentials.
- A user account with access to the <ManagerLink to="/">OVHcloud Control Panel</ManagerLink>.
- Having **NSX** deployed with two segments configured in your NSX configuration, you can use this guide [Segment management in NSX](/pl/guides/hosted-private-cloud/powered-by-vmware/nsx-segment-management.md).
- Two virtual machines with NGINX enabled on one segment.

## 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 and choose `Edit
` from the menu.
![01 Add tag to VMs 01](/images/hosted-private-cloud/powered-by-vmware/nsx-09-configure-loadbalancing/01-add-tag-to-two-vm01.png)
Replace **Tag**
 with `loadbl`
, then click `Add Item(s) loadbl
` below.
![01 Add tag to VMs 02](/images/hosted-private-cloud/powered-by-vmware/nsx-09-configure-loadbalancing/01-add-tag-to-two-vm02.png)
Change **Scope**
 to `nginx
`, then click `Add Item(s) nginx
` below.
![01 Add tag to VMs 03](/images/hosted-private-cloud/powered-by-vmware/nsx-09-configure-loadbalancing/01-add-tag-to-two-vm03.png)
Click the `\+
` sign next to your tag to add it to your virtual machine.
![01 Add tag to VMs 04](/images/hosted-private-cloud/powered-by-vmware/nsx-09-configure-loadbalancing/01-add-tag-to-two-vm04.png)
The tag appears, click `SAVE
`.
![01 Add tag to VMs 05](/images/hosted-private-cloud/powered-by-vmware/nsx-09-configure-loadbalancing/01-add-tag-to-two-vm05.png)
Click the `three vertical dots
` to the left of the second virtual machine and choose `Edit
` from the menu.
![01 Add tag to VMs 06](/images/hosted-private-cloud/powered-by-vmware/nsx-09-configure-loadbalancing/01-add-tag-to-two-vm06.png)
Replace **Tag**
 with `load
` and select the `Tag: loadbl Scope: nginx
` that just appeared below.
![01 Add tag to VMs 07](/images/hosted-private-cloud/powered-by-vmware/nsx-09-configure-loadbalancing/01-add-tag-to-two-vm07.png)
Click the `\+
` sign next to your tag to add it to your second virtual machine.
![01 Add tag to VM 08](/images/hosted-private-cloud/powered-by-vmware/nsx-09-configure-loadbalancing/01-add-tag-to-two-vm08.png)
Click `SAVE
` to add the tag to your virtual machine.
![01 Add tag to VM 09](/images/hosted-private-cloud/powered-by-vmware/nsx-09-configure-loadbalancing/01-add-tag-to-two-vm09.png)
Stay on **Inventory**
, click `Tags
` and click on the `number
` to the right of the marker you created.
![02 Show member tag 01](/images/hosted-private-cloud/powered-by-vmware/nsx-09-configure-loadbalancing/02-show-members-tag01.png)
You can see your two virtual machines using the same tag.

![02 Show member tag 02](/images/hosted-private-cloud/powered-by-vmware/nsx-09-configure-loadbalancing/02-show-members-tag02.png)
### Add group with created tag

Select `Groups
` on the left and click `ADD GROUP
`.
![03 ADD GROUP 01](/images/hosted-private-cloud/powered-by-vmware/nsx-09-configure-loadbalancing/03-add-group01.png)
Enter `nginx-server`
 below **Name**
 and click `SET
` under **Compute Members**
.
![03 ADD GROUP 02](/images/hosted-private-cloud/powered-by-vmware/nsx-09-configure-loadbalancing/03-add-group02.png)
Click `\+ ADD CRITERION
`.
![03 ADD GROUP 03](/images/hosted-private-cloud/powered-by-vmware/nsx-09-configure-loadbalancing/03-add-group03.png)
Keep **Virtual Machine Tag Equals**
 and select your `loadbl
` tag with its `nginx
` scope and click `APPLY
`.
![03 ADD GROUP 04](/images/hosted-private-cloud/powered-by-vmware/nsx-09-configure-loadbalancing/03-add-group04.png)
Click `SAVE
`.
![03 ADD GROUP 05](/images/hosted-private-cloud/powered-by-vmware/nsx-09-configure-loadbalancing/03-add-group05.png)
Click `View Members
` to the right of the group.
![03 ADD GROUP 06](/images/hosted-private-cloud/powered-by-vmware/nsx-09-configure-loadbalancing/03-add-group06.png)
The list of virtual machines is automatically added to the group based on the criteria in your tag.

![03 ADD GROUP 07](/images/hosted-private-cloud/powered-by-vmware/nsx-09-configure-loadbalancing/03-add-group07.png)
### Activating the Load Balancer

Go to the `Networking
` tab and click on `Load Balancing
` in the **Network Services**
 section on the left.
Then go to the `Load Balancers
` tab and click `ADD LOAD BALANCER
`.
![04 Activate Load Balancer 01](/images/hosted-private-cloud/powered-by-vmware/nsx-09-configure-loadbalancing/04-activate-loadbalancing01.png)
Enter `loadbalancer-on-t1`
 below **Name**
, select `ovh-T1-gw
` under **Attachment**
 and click `SAVE
`.
![04 Activate Load Balancer 02](/images/hosted-private-cloud/powered-by-vmware/nsx-09-configure-loadbalancing/04-activate-loadbalancing02.png)
Click `NO
`.
![04 Activate Load Balancer 03](/images/hosted-private-cloud/powered-by-vmware/nsx-09-configure-loadbalancing/04-activate-loadbalancing03.png)
The Load Balancer is created and activated on the **ovh-T1-gw** gateway.

![04 Activate Load Balancer 04](/images/hosted-private-cloud/powered-by-vmware/nsx-09-configure-loadbalancing/04-activate-loadbalancing04.png)
### Server pool creation

Go to the `Server Pools
` tab and click `ADD SERVER POOL
`.
![05 Add server pool 01](/images/hosted-private-cloud/powered-by-vmware/nsx-09-configure-loadbalancing/05-add-server-pool01.png)
Enter `sp-nginx`
 below **Name**
 and click `Select Members
` under **Members/Group**
.
![05 Add server pool 02](/images/hosted-private-cloud/powered-by-vmware/nsx-09-configure-loadbalancing/05-add-server-pool02.png)
Click `Select a group
` and choose the `nginx-servers
` group you created then click `APPLY
`.
![05 Add server pool 03](/images/hosted-private-cloud/powered-by-vmware/nsx-09-configure-loadbalancing/05-add-server-pool03.png)
Click `SAVE
` to apply your changes.
![05 Add server pool 04](/images/hosted-private-cloud/powered-by-vmware/nsx-09-configure-loadbalancing/05-add-server-pool04.png)
Your server pool is created with your two virtual machines that are members of the group.

![05 Add server pool 05](/images/hosted-private-cloud/powered-by-vmware/nsx-09-configure-loadbalancing/05-add-server-pool05.png)
### 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
`.
![06 Add virtual Server 01](/images/hosted-private-cloud/powered-by-vmware/nsx-09-configure-loadbalancing/06-add-virtual-server01.png)
Select `L4 TCP
`.
![06 Add virtual Server 02](/images/hosted-private-cloud/powered-by-vmware/nsx-09-configure-loadbalancing/06-add-virtual-server02.png)
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 <code className="action">80</code>.
- **Load Balancer**: Your load balancer <code className="action">loadbalancer-on-t1</code>.
- **Server Pool**: Your server pool <code className="action">sp-nginx</code>.

Then click `SAVE
`.
![06 Add virtual Server 03](/images/hosted-private-cloud/powered-by-vmware/nsx-09-configure-loadbalancing/06-add-virtual-server03.png)
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
`.
![07 ADD DNAT TO VIRTUAL SERVER 01](/images/hosted-private-cloud/powered-by-vmware/nsx-09-configure-loadbalancing/07-add-dnat-to-virtual-server01.png)
Enter `to-lb-virtual-server
` in your rule **Name**
 with these options :
- **Action** : <code className="action">DNAT</code>.
- **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.3`.
- **Service PORT** : Choose the predefined port <code className="action">HTTP| 80</code>.

Then click `SAVE
`.
![07 ADD DNAT TO VIRTUAL SERVER 02](/images/hosted-private-cloud/powered-by-vmware/nsx-09-configure-loadbalancing/07-add-dnat-to-virtual-server02.png)
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.

![07 ADD DNAT TO VIRTUAL SERVER 03](/images/hosted-private-cloud/powered-by-vmware/nsx-09-configure-loadbalancing/07-add-dnat-to-virtual-server03.png)
## Go further [](#)
[Getting started with NSX](/pl/guides/hosted-private-cloud/powered-by-vmware/nsx-first-steps.md)

[Segment management in NSX](/pl/guides/hosted-private-cloud/powered-by-vmware/nsx-segment-management.md)

[Implementing NAT for port redirections in NSX](/pl/guides/hosted-private-cloud/powered-by-vmware/nsx-configure-nat-redirection.md)

[VMware NSX Load Balancer documentation](https://docs.vmware.com/en/VMware-NSX-T-Data-Center/3.2/administration/GUID-D39660D9-278B-4D08-89DF-B42C5400FEB2.html)

If you need training or technical assistance to implement our solutions, contact your sales representative or click on [this link](https://www.ovhcloud.com/pl/professional-services/) to get a quote and ask our Professional Services experts for a custom analysis of your project.

Join our community of users on [https://community.ovh.com/en/](https://community.ovh.com/en/).
