Learn how to configure an OVHcloud Load Balancer service to balance load across several servers that respond in SMTP.
In this guide, we will configure a basic TCP load balancing service, for one or more SMTP servers. A TCP front-end will listen to TCP traffic on port 25. It is configured to direct traffic to a TCP server cluster with one or more TCP servers, depending on how you configure it.
As a reminder, each protocol (HTTP and TCP) in the OVHcloud Load Balancer service has its own associated front-ends, server clusters, and servers.
Instructions
Access your OVHcloud Load Balancer service
From the OVHcloud Control Panel:
- Select
Bare Metal Cloud
from the top navigation bar. - Expand the
Network
section in the left-hand menu. - Click
Load Balancer
and select your service.
On the Home screen, you will see the following:
Navigate to the GET /ipLoadbalancing section of the OVHcloud API.
For more information on the API’s features, you can refer to the following guide.
Add a server cluster
We will add a server cluster of TCP servers to our service, which is the part that balances traffic on the servers.
From the OVHcloud Control Panel select the Server clusters
tab and click the Add a server
cluster
button.
On the next screen, fill in the fields:
- Name (optional)
-
Protocol:
SSL TCP (TLS)
- Port: 25
- Datacenter
Click Add
once you have filled in the fields.
Your server cluster should appear in the list in the Server clusters
tab.
From the OVHcloud API you can:
- List TCP server clusters: GET /ipLoadbalancing/{serviceName}/tcp/farm
- Find details of a specific TCP server: GET /ipLoadbalancing/{serviceName}/tcp/farm/{farmId}
- Add a new TCP server cluster: POST /ipLoadbalancing/{serviceName}/tcp/farm
- Modify a specific server cluster: PUT /ipLoadbalancing/{serviceName}/tcp/farm/{farmId}
- Delete a specific server cluster: DELETE /ipLoadbalancing/{serviceName}/tcp/farm/{farmId}
Add a server
We will now add a server to our server.
From the OVHcloud Control Panel, from the Server clusters tab, expand the server cluster you just created.
Click Add a server
.
On the next screen, fill in the fields:
- Name (optional)
- IPv4 address
- Port: 25
Click Add
once you have filled in the fields.
Your server should appear in the Server clusters
tab, just below the server cluster created in the previous step.
From the OVHcloud API you can:
- List servers in the server cluster: GET /ipLoadbalancing/{serviceName}/tcp/farm/{farmId}/server
- Find details of a specific server: GET /ipLoadbalancing/{serviceName}/tcp/farm/{farmId}/server/{serverId}
- Add a new server: POST /ipLoadbalancing/{serviceName}/tcp/farm/{farmId}/server
- Modify a specific server: PUT /ipLoadbalancing/{serviceName}/tcp/farm/{farmId}/server/{serverId}
- Delete a specific server: DELETE /ipLoadbalancing/{serviceName}/tcp/farm/{farmId}/server
Add a front-end
We will now add a front-end to our service, and connect it to our server cluster. The front-end is the part of your OVHcloud Load Balancer that exposes your service on the internet.
In the OVHcloud Control Panel, from the Front-ends
tab, click Add a front-end
.
On the next screen, fill in the fields:
- Name (optional)
-
Protocol:
SSL TCP (TLS)
-
Port: 25
If you want your service to be available across several ports at once, you can specify a list of ports, separated by commas, or a range of ports, in the format "start_port-end_port".
- Datacenter
- Default server cluster: the cluster you created at the beginning of this guide.
If you have routed Additional IPs to your OVHcloud Load Balancer service, you can also attach a front-end to one or more specific Additional IPs.
Click Add
once you have filled in the fields.
Your front-end will appear in the Front-ends
tab.
From the OVHcloud API you can:
- List TCP front-ends: GET /ipLoadbalancing/{serviceName}/tcp/frontend
- Find details of a specific front-end: GET /ipLoadbalancing/{serviceName}/tcp/frontend/{frontendId}
- Add a new front-end: POST /ipLoadbalancing/{serviceName}/tcp/frontend
- Modify a specific front-end: PUT /ipLoadbalancing/{serviceName}/tcp/frontend/{frontendId}
- Delete a specific front-end: DELETE /ipLoadbalancing/{serviceName}/tcp/frontend/{frontendId}
Apply the modifications
The modifications made to your OVHcloud Load Balancer must be explicitly applied in each of the zones configured for your service. Only at this point will they be visible to your website visitors. This way, you can make complex configuration changes several times, and only apply them once the configuration is ready.
In the OVHcloud Control Panel, click Apply configuration
in the yellow banner.
On the next screen, select ☑
your Datacenter and click Apply configuration
again.
From the OVHcloud API:
- Refresh a zone: POST /ipLoadbalancing/{serviceName}/refresh
Postfix configuration
To make Postfix compatible with HAProxy ProxyProtocol, an option is required in the postfix main.cf configuration file:
smtp_upstream_proxy_protocol = haproxy
You then need to restart your Postfix daemon.
Confirmation
After you have completed all of these steps, you should now have a functional Load Balancer service for your SMTP servers. You can now check the service status by requesting your IP Load Balancer as an SMTP server.
Go further
For more information and tutorials, please see our other OVHcloud Load Balancer guides or explore the guides for other OVHcloud products and services.