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)?
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.+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.
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.