On Tue, 7 Feb 2012, Lorens Kockum wrote:

On Tue, Feb 07, 2012 at 11:42:37AM +1100, Greg Wilson wrote:
I use this
technique, DNS round robin to evenly spread rdp connections to our
terminal servers. My understanding is that a device does a DNS lookup and
the server hands out each different IP address sequentially. Each device
uses (caches) the first IP address it recieves until it's rebooted.

That might be true for rdp connections to your terminal servers,
but (luckily!) it's a bit more complicated.

The DNS server sends a reply containing all the IP
addresses. The order varies. If the code asking the question
only wants one address, then it takes only one, and the next
time it asks the question it might get another answer.  Postfix,
however, understands that there are multiple addresses and
tries them all, one after the other in a random order until
one replies or until it has tried them all and decides to wait
before trying again. After waiting Postfix will make another DNS
lookup.

The response to that lookup may be cached since the previous
lookup, but the cache is valid only until the record's time to
live (TTL) expires. The TTL is set in the DNS server. It can
be anything from zero ("do not cache") to a week or more. A
common default value is 24 hours. Of course, in the case of
a long-lived TCP connection you may have the impression that
the IP address is used until the device is restarted, and you
might even be correct (for an RDP client running on Windows, for
example), but that is not the case when sending mails.

Is it possible to setup multiple transport records wth different
costs to a domain? This may be a solution.

You can do unequal load balancing by creating multiple records
with the same IP.  That could work using /etc/hosts, you'd have
to test.

You can do priorities (first try X and if it doesn't work try
Y then Z) by using different-priority MX records. This needs
access to your DNS server, and cannot be done with /etc/hosts.

Hope this helps.



As an alternative, it guess it would suffice to put an MX with lower priority in your dns to the backup server, so if mastern in your cluster is down postfix would then try next one. But what Loren wrote before creating loadbalancing with round-robin is probably what you want.

Reply via email to