I have a 14.04 LTS server installation. It is relatively new. It is up to date on its patches. I'm running postfix on it and I noticed that the SMTP server was having trouble resolving delivery.mailspamprotection.com (siteground's outgoing mail server.).

When I use dig I get all of the addresses (about 30 of them). I have a small C program that uses libc6's getaddrinfo() function. That returns only one address. I am running my own recursing nameserver (pdns-recursor) which seems to be running fine. I've run queries against it from other servers and it's returning the correct information. I've also run queries from this server to different recursors using dig and I get the correct information.

However, when I run the little program that uses the libc6 resolver library (getaddrinfo()), I only get one address back. The host.conf setting of multi on is set. I have order bind,hosts, multi on, no-spoof on .

I have another 14.04 LTS host that works fine. libc6 version 2.19-0ubuntu6.7.

Anyone have any ideas?

  • The manpage says getaddrinfo configuration is in /etc/gai.conf. Do both servers have the same /etc/gai.conf? – muru Feb 20 '16 at 23:06
  • That changes how the addresses are sorted and precedence. It doesn't say anything about whether multiple addresses or a single address are returned. – Curtis Maurand Feb 22 '16 at 19:34
  • [SOLVED] The problem was in the /etc/nsswitch.conf. changed the line "hosts: files dns" to "hosts: dns files" and that solved the problem. – Curtis Maurand Feb 22 '16 at 19:52

[SOLVED] The problem was in the "/etc/nsswitch.conf". I changed the line "hosts: files dns" to "hosts: dns files" and that solved the problem.

Further, in a note of embarrassment, the host in question was also in the "/etc/hosts" file. I don't remember doing that, so it was a self inflicted problem.

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.