Learn how to configure the OVHcloud Load Balancer to distribute traffic across multiple SMTP servers.
Requirements
- An OVHcloud Load Balancer service in your OVHcloud account
- Access to the OVHcloud Control Panel
-
A Postfix-type SMTP service installed and configured on your servers
NOTE: This guide assumes a working knowledge of SMTP protocol and service operation.
Instructions
As a reminder, each protocol (HTTP and TCP) in the OVHcloud Load Balancer service has its own associated front-ends, server clusters, and servers.
NOTE: The order in which elements are created is important. In particular, the server clusters must be configured before we can attach servers to them.
Access your OVHcloud Load Balancer service
From the OVHcloud Control Panel, navigate to the Load Balancer section via the Network menu.
If you are not using the beta version of the OVHcloud Control Panel, you will find the Load Balancer section via the Bare Metal Cloud or Hosted Private Cloud menus.
In the Home tab, you will see the following:
Via the OVHcloud API, use the following call:
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
If no ports are specified, your OVHcloud Load Balancer will automatically use the same port as the corresponding front-end. Also, in the Advanced settings, you can add an SMTP probe on your server cluster.
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:
-
Find details of a specific TCP server:
-
Add a new TCP server cluster:
-
Modify a specific server cluster:
-
Delete a specific server cluster:
Add a server
We will now add a server to our server.
In the Server clusters tab, select the cluster you want to add a server to by clicking the corresponding line. The list of servers already configured in the cluster will appear beneath the list of clusters, along with the Add a server button. Click this button to add a new server.
The mandatory fields are IPv4 address, Status, and ProxyProtocol version. If a server port is configured, it will override the port defined in the farm. To keep the configuration as standard as possible and easy to maintain, we recommend only using this parameter in advanced cases.
NOTE: It is important to configure ProxyProtocol in version v1, so that you can retrieve the real source IP on your SMTP service. Postfix is compatible with this protocol.
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:
-
Find details of a specific server:
-
Add a new server:
-
Modify a specific server:
-
Delete a specific server:
Add a frontend
We will now add a frontend to our service and connect it to our server cluster. The front-end is the component 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 "-".
- Datacenter
- Default server cluster: the cluster you created at the beginning of this guide.
NOTE: If you configured a probe on your cluster, you need to open the Advanced settings to configure a probe here as well.
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:
-
Find details of a specific front-end:
-
Add a new front-end:
-
Modify a specific front-end:
-
Delete a specific front-end:
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.
If you have several regions, you must apply the same configuration for each of them.
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, you can apply your configuration with the following API call:
Postfix configuration
To make Postfix compatible with HAProxy ProxyProtocol, an option is required in the postfix main.cf configuration file:
smtp_upstream_proxy_protocol = haproxyYou 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.