MX rotation and load balancing

Johan van Selst koresh+comp_protocols_dns_bind at dohd.cx
Wed Jul 21 09:33:28 UTC 1999


I have noticed that bind8 rotates MX records just like A records, which
seems to be a good thing. However I have the mailhosts for my domain set
up as follows:

	@	MX	10 mail1.mydomain
	@	MX	10 mail2.mydomain
	@	MX	10 mail3.mydomain
	@	MX	20 mail1.myisp
	@	MX	20 mail2.myisp
	@	MX	30 mail3.myisp

However bind rotates this entire list, which means that in the next
state, the client will see:

	@	MX	10 mail2.mydomain
	@	MX	10 mail3.mydomain
	@	MX	20 mail1.myisp
	@	MX	20 mail2.myisp
	@	MX	30 mail3.myisp
	@	MX	10 mail1.mydomain

etc.
With the effect that mail1.mydomain will be listed before mail2.mydomain
in 5 of 6 states. And as many mailserver implementations are simply
picking the first MX record with the lowest weight, this means that
mail1.mydomain gets much more traffic than mail3.mydomain. This seems to
defeat the purpose of having multiple hosts with the same weight. I
guess this is a mailer problem, but that's a problem for remote hosts:
nothing I can do about it. More intelligent rotation in bind would help
as well.

Another solution I tried is having multiple A records for the mailhost
(which are also rotated by bind):

	@	MX	10	mail.mydomain
	@	MX	20	mail1.myisp
	@	MX	20	mail2.myisp
	@	MX	30	mail3.myisp
	mail	A	192.168.1.1
	mail	A	192.168.1.2
	mail	A	192.168.1.3

This works a lot better for load balancing, however as soon as one of
the three mailhosts drop dead, a lot of the mail for my site is routed
via mail1.myisp because many mailservers don't seem to check for
multiple A records, but only use the first one. If this happens to be
the host that is down, then they immediately use the backup hosts.

I guess the ideal solution would be something like:

	@	MX	10	dummy1.mydomain
	@	MX	10	dummy2.mydomain
	@	MX	10	dummy3.mydomain
	@	MX	20	mail1.myisp
	@	MX	20	mail2.myisp
	@	MX	30	mail3.myisp
	dummy1	A	192.168.1.1
	dummy1	A	192.168.1.2
	dummy1	A	192.168.1.3
	dummy2	A	192.168.1.2
	dummy2	A	192.168.1.3
	dummy2	A	192.168.1.1
	dummy3	A	192.168.1.3
	dummy3	A	192.168.1.1
	dummy3	A	192.168.1.2

However this just doesn't look "nice" to me. Is there any other way
which I may be missing?


Greetings,

Johan van Selst


More information about the bind-users mailing list