Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Our SMTP provider requires to distribute emails evenly between four different hosts. I understand that the standard way to distribute this kind of load is utilizing DNS round robin feature, but the problem is that provider's mailservers should be addressed using symbolic names not IPs. What is the best way to handle this? Will setting multiple CNAME records work or should I use any internal Sendmail/Postfix/Exim/etc balancing capability (which I am currently not aware of)?

share|improve this question

3 Answers 3

up vote 6 down vote accepted

Your provider's an idiot. They should give you one server name to plug into your MTA and do their own load balancing. I'd be inclined just to throw one name into my relayhost directive and be done with it. You could define a local name with the A records of all your provider's machines (taken from resolving the names they've given you), but it makes no sense to have to do so, because every time your provider decides to add more servers to their cluster you have to make a config change.

share|improve this answer
    
Yeah, their "requirements" stink. I do something similar for our copiers and internal equipment that need SMTP. We have multiple A records in DNS and let windows handle the round robining. But in truth it's not a good solution, as Windows DNS doesn't round robin multiple entries. (But maybe your OS of choice has a better way to do this) In our case, it's really there as a crappy work around for when we reboot one of our SMTP boxes as the copiers are smart enough to see one of the servers is down and use the other one. –  MikeAWood Aug 26 '11 at 22:08
    
@Mike it gets off-topic but in this case you should set up one host with one IP as a load balancer and do the round robin with iptables rules. That is a poor-man's load balancer, but works around your Windows issue. –  mailq Aug 26 '11 at 23:07
1  
"Poor man's load balancer", as used by such lowly companies as Google and Yahoo. –  womble Aug 26 '11 at 23:09
    
Boom! - Wombled. –  artifex Aug 27 '11 at 22:49
    
@mailq in my case, I don't need it to round robin. My workaround is to use our Firewall as the load balancer for the SMTP traffic. Takes care of the email from Postini along with the copiers quite nicely. Much simpler and certainly more reliable. –  MikeAWood Sep 13 '11 at 0:42

Well, BIND 9.x does not support multiple CNAME entries since this breaks RFCs, what a surprise! But I've found a possible solution here: http://marc.info/?l=postfix-users&m=118849453519781&w=2 I'm going to implement this, will provide a report here just for the record.

share|improve this answer
    
I gave up finally and set up an A DNS record in our own domain pointing to IPs of provider's mail relays. Our box runs exim historically, so I decided not to mess with A-less MX records because I was on a production system and needed a quick solution. –  Alex Aug 27 '11 at 3:05

+1 for "Your Provider is an idiot".

Nevertheless, you could solve its requirement by setting up some loadbalancer (e.g. HAProxy) locally which uses your provider's smarthosts as backends. Your servers would then direct their mails to this loadbalancer. It will not strictly balance based on emails, but on TCP connections. But I guess that should be good enough, as it's rather hard to decide how many individual mails are going to be generated at then end (because of multiple recipients, mailinglists, aliases, ...)

Also when your provider's servers change, you just need to adapt the loadbalancer's configuration and do not need to touch any other servers.

You might need to consider high availability of the loadbalancer though as it would be a single-point-of-failure.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.