Thursday, October 28, 2010

sendmail, Solving ‘host name lookup failure’ at name server

To solve the problem of 'host name lookup failure’ on sendmail, first you need to determine if it's really this problem.

check the /var/log/maillog , there should be entry such as below

xxxxxx sendmail[30685]: o9T3l3Pe030683: to=, ctladdr= (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=120354,, dsn=4.0.0, stat=Deferred: Name server: host name lookup failure

Then we try to nslookup the mail server, by dig It should show that the connection is time out.

; <<>> DiG 9.3.4-P1 <<>>
;; global options: printcmd
;; connection timed out; no servers could be reached

Next, we can resolved this by setting up name server or put the mail server into the /etc/mail/mailertable .

First by checking the /etc/nsswitch.conf to see if we are using hosts file.
#hosts: files dns

Then do the following to create the entry in the mailertable. smtp:[]

then we hash the file to the mailertable.db
makemap hash /etc/mail/mailertable < /etc/mail/mailertable

after that, restart the sendmail by running service sendmail restart

Reference link