We have been always told that MX (mail exchanger) DNS Record will load balance itself but this is not true always. We will understand how should we careful in planning our mx records and their priorities.
- Terminology : –
- MX Record – This dns record type is meant for domains to publish their mail server details to receive email on internet.
- MX Record Preference – This value can be between 0 to 65535. Lowest the value highest the priority. This value controls how sender (MUA) will choose your mx record.
- Multiple Host in MX Record – We can have more than 1 host in a mx record of a domain.
- TTL – Time to leave of a dns record, if we keep this value minimal then it will help us during switchover. DNS Clients cache dns record for the TTL period and then refresh their cache.
- Spammers – It is common practice of spammers to hit high preference mx record because they assume that it will not be highly secure.
- MX Record Load balancing.
- We will take example of MX record of google.com, it has multiple hosts with different preference.
- Here google mx record has preference of 10,20,30,40,50.
- MUA will use priority 10 for sending email first and 50 will be used last.
- It is expected that if priority 10 is not responding or it is throwing 4xx errors then MUA should failover to 20 and so on.
- I did testing through cisco ironport and noticed that load balncing only occurs between first two host with 10 priority and others are not retried at all.
- if priority of all hosts are changed to 10 or all are made equal priorty then in case of failover all are retried.
- We are sure with our testing that it is MUA’s responsibility to retry all MX Hosts when one is not available but in real world secenario all MUAs are not designed as well.
- Hence please be careful when you assume that having different priority will give you high availability as well.