Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

CentOS 5.x | SendMail

I have a SendMail server configured to smarthost to a FQDN (for the purpose of discussion, let's call it originally had two A records associated with it: and Under this scenario, it would usually send email evenly to both servers.

I've recently added a third A record to the same FQDN: What's strange is that I'm not seeing any traffic ever going to

My questions are:

1) Does SendMail cache DNS records? If so, how can this be flushed?

2) How does sendmail (or the native dns resolver if it's just CentOS) evaluate which of the 3 A records to use?

share|improve this question
up vote 2 down vote accepted

I don't have an authoritative answer, but generally if something is caching DNS records it will probably respect the TTL associated with the record. The native resolver will generally return DNS records in the order returned from your nameserver, and most nameservers will rotate multiple entries for a single resource. For example:

$ host has address has address has address

$ host has address has address has address

Applications will generally use the first result (although this isn't a given; some applications may choose a random result from the list).

share|improve this answer
Thanks. That's helpful info. – Mike B Aug 17 '12 at 19:21
Bingo. That was it. The third host was never coming back as the top spot in the DNS query results. Thank you! – Mike B Aug 22 '12 at 17:05

Apart from the TTL stuff mentioned by larsks, there is also SMTP connection caching that adds to the phenomenon. From the bat book I copy:

When sendmail caches a connection, it connects to the host and transmits the mail message as usual. But instead of closing the connection, it keeps the connection open so that it can transmit additional mail messages without the additional overhead of opening and closing the connection each time. The ConnectionCacheSize option of V8 sendmail specifies that open connections to other hosts should be maintained, and it specifies the maximum number of those connections.

share|improve this answer
Interesting! So in theory, a busy server with a steady stream of messages would tend to use the same server because it would leave the connection open? Does the bat book say what the default cache limit is? I'm also confused on why it's a "size" related option and not a "time" related thing. – Mike B Aug 17 '12 at 20:48
Actually there are two options: ConnectionCacheSize and ConnectionCacheTimeout. You do not want the size to be larger than 4, for you will need to increase the file open descriptors maximum on the system. – adamo Aug 17 '12 at 21:05
Hmm... So if that was the case, restarting the sendmail service would terminate any open lingering connections right? – Mike B Aug 17 '12 at 23:47
Yes. Restarting as in service sendmail stop followed by service sendmail start. A kill -HUP would not do that. – adamo Aug 18 '12 at 14:11

Your Answer


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.