CentOS 5.x | SendMail

I have a SendMail server configured to smarthost to a FQDN (for the purpose of discussion, let's call it group.example.com). group.example.com 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?


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 group.example.com
group.example.com has address
group.example.com has address
group.example.com has address

$ host group.example.com
group.example.com has address
group.example.com has address
group.example.com 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).

  • 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.

  • 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
  • 1
    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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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