Using Round robin DNS (building load balancer) (WebMail Pro 6 PHP)

From AfterLogic Wiki

Jump to: navigation, search

Introduction

Round robin DNS method is used for balancing the load of distributed Web/Mail/Service servers. For example, a company has one domain name and three identical services residing on three servers with three different IP addresses. When one user accesses the home page it will be sent to the first IP address. The second user who accesses the home page will be sent to the next IP address, and the third user will be sent to the third IP address. In each case, once the IP address is given out, it goes to the end of the list. The fourth user, therefore, will be sent to the first IP address, and so forth.

Round robin for mail balancing

We must define multiple MX records with the same priority, e.g.:

; zone file fragment
      IN  MX  10  mail.example.com.
      IN  MX  10  mail1.example.com.
      IN  MX  10  mail2.example.com.
....
mail  IN  A       192.168.0.4
mail1 IN  A       192.168.0.5
mail2 IN  A       192.168.0.6

The name server will deliver the MX records in the order defined by the rrset-order and the receiving SMTP software will select one based on its algorithm. In some cases the SMTP algorithm may work against the definition of the rrset-order statement. Current versions of sendmail (8.13.x), Exim (4.44) and Postfix (2.1 or 2.2) all have definitive references to indicate they randomly select equal preference servers (Postfix allows control of the behaviour with the smtp_randomize_addresses parameter) and consequentially may use an address which the rrset-order has carefully tried to change! qmail, courier-mta and Microsoft (Exchange and IIS SMTP) documentation does not appear to have definitive references to indicate how they handle this case.

The alternate approach is to define multiple A records with the same name and multiple IP addresses.

        IN  MX  10  mail.example.com.
....
mail    IN  A       192.168.0.4
        IN  A       192.168.0.5
        IN  A       192.168.0.6

In this case the load-balancing effect is under the control of BIND and the rrset-order record. In order to avoid problems if the receiving mail system does reverse look-up as a spam check then the PTR records for 192.168.0.4, 192.168.0.5, 192.168.0.6 above must all define to mail.example.com.

In all the above cases each mail server must be capable of handling and synchronising the load for all the mail boxes served by the domain, using some appropriate back-end to do this or by defining all but one server to be a relay or forwarder.

Round robin for balancing other services

Assuming you want to load share your ftp or web services then you simply define multiple A records with the same name and different IPs as in the example below.

; zone file fragment
ftp   IN  A   192.168.0.4
ftp   IN  A   192.168.0.5
ftp   IN  A   192.168.0.6
www   IN  A   192.168.0.7
www   IN  A   192.168.0.8

; or use this format which gives exactly the same result
ftp   IN  A   192.168.0.4
      IN  A   192.168.0.5
      IN  A   192.168.0.6
www   IN  A   192.168.0.7
      IN  A   192.168.0.8

The DNS will deliver all the IP addresses defined, the first IP address in the list will be in a default round robin (controlled by the rrset-order 'named.conf' statement). The FTP and WEB servers must all be exact replicas of each other in this scenario.

Last edit: 2011/2/21

WebMail Pro PHP documentation

Installation


Configuring WebMail

Customization

Integration

Synchronization

Clustering

See Also