Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am using a custom build of exim (bundled with afterlogic pro mailsuite) with centos5.6. The system cannot send to remote mail servers like yahoo or gmail and gives this error:

someuser@gmail.com R=dnslookup defer (-1): host lookup did not complete

I can lookup gmail.com dns records with dig command:

    #dig mx gmail.com

; <<>> DiG 9.3.6-P1-RedHat-9.3.6-16.P1.el5 <<>> mx gmail.com
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 2234
;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;gmail.com.         IN  MX

;; ANSWER SECTION:
gmail.com.      3600    IN  MX  30 alt3.gmail-smtp-in.l.google.com.
gmail.com.      3600    IN  MX  20 alt2.gmail-smtp-in.l.google.com.
gmail.com.      3600    IN  MX  5 gmail-smtp-in.l.google.com.
gmail.com.      3600    IN  MX  10 alt1.gmail-smtp-in.l.google.com.
gmail.com.      3600    IN  MX  40 alt4.gmail-smtp-in.l.google.com.

;; Query time: 16 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Fri Mar 16 16:23:27 2012
;; MSG SIZE  rcvd: 150

I ran a debug command with exim and it came like this:

    #bin/exim -bt -d-resolver someuser@gmail.com
Exim version 4.76 uid=0 gid=0 pid=2368 D=fbb95cfd
Berkeley DB: Berkeley DB 5.2.36: (September 14, 2011)
Support for: crypteq iconv() OpenSSL Content_Scanning DKIM
Lookups (built-in): lsearch wildlsearch nwildlsearch iplsearch dbm dbmnz mysql
Authenticators: cram_md5 plaintext spa
Routers: accept dnslookup ipliteral manualroute queryprogram redirect
Transports: appendfile/maildir autoreply pipe smtp
Fixed never_users: 0
Size of off_t: 8
Compiler: GCC [4.1.2 20080704 (Red Hat 4.1.2-51)]
Library version: OpenSSL: Compile: OpenSSL 1.0.0e 6 Sep 2011
                          Runtime: OpenSSL 1.0.0e 6 Sep 2011
Library version: PCRE: Compile: 8.13
                       Runtime: 8.13 2011-08-16
Total 7 lookups
Library version: MySQL: Compile: 5.1.56 [Source distribution]
                        Runtime: 5.1.56
WHITELIST_D_MACROS unset
TRUSTED_CONFIG_LIST unset
changed uid/gid: forcing real = effective
  uid=0 gid=0 pid=2368
  auxiliary group list: <none>
seeking password data for user "exim": cache not available
getpwnam() succeeded uid=3000 gid=3000
seeking password data for user "root": cache not available
getpwnam() succeeded uid=0 gid=0
configuration file is /usr/mailsuite/etc/exim
log selectors = 0000cefe 00233821
trusted user
admin user
seeking password data for user "exim": cache not available
getpwnam() succeeded uid=3000 gid=3000
seeking password data for user "exim": using cached result
getpwnam() succeeded uid=3000 gid=3000
seeking password data for user "exim": using cached result
getpwnam() succeeded uid=3000 gid=3000
originator: uid=0 gid=0 login=root name=root
sender address = root@example.com
Address testing: uid=0 gid=3000 euid=0 egid=3000
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Testing someuser@gmail.com
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Considering someuser@gmail.com
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
routing someuser@gmail.com
--------> dnslookup router <--------
local_part=someuser domain=gmail.com
checking domains
search_open: mysql "NULL"
search_find: file="NULL"
  key="SELECT name FROM awm_domains WHERE name = 'gmail.com' AND is_internal = 1 " partial=-1 affix=NULL starflags=0
LRU list:
internal_search_find: file="NULL"
  type=mysql key="SELECT name FROM awm_domains WHERE name = 'gmail.com' AND is_internal = 1 "
database lookup required for SELECT name FROM awm_domains WHERE name = 'gmail.com' AND is_internal = 1 
MySQL query: SELECT name FROM awm_domains WHERE name = 'gmail.com' AND is_internal = 1 
MYSQL new connection: host=localhost port=0 socket=/usr/mailsuite/tmp/mysql.sock database=exim user=root
MYSQL: no data found
lookup failed
gmail.com in ""? no (end of list)
gmail.com in "! +local_domains"? yes (end of list)
calling dnslookup router
dnslookup router called for someuser@gmail.com
  domain = gmail.com
DNS lookup of gmail.com (MX) succeeded
DNS lookup of gmail-smtp-in.l.google.com (A) succeeded
DNS lookup of alt1.gmail-smtp-in.l.google.com (A) succeeded
DNS lookup of alt2.gmail-smtp-in.l.google.com (A) succeeded
DNS lookup of alt3.gmail-smtp-in.l.google.com (A) succeeded
DNS lookup of alt4.gmail-smtp-in.l.google.com (A) succeeded
fully qualified name = gmail.com
host_find_bydns yield = HOST_FOUND (2); returned hosts:
  gmail-smtp-in.l.google.com 209.85.225.27 MX=5 
  alt1.gmail-smtp-in.l.google.com 173.194.76.27 MX=10 
  alt2.gmail-smtp-in.l.google.com 74.125.115.27 MX=20 
  alt3.gmail-smtp-in.l.google.com 173.194.67.26 MX=30 
  alt4.gmail-smtp-in.l.google.com 173.194.65.26 MX=40 
set transport remote_smtp
queued for remote_smtp transport: local_part = someuser
domain = gmail.com
  errors_to=NULL
  domain_data=NULL localpart_data=NULL
routed by dnslookup router
  envelope to: someuser@gmail.com
  transport: remote_smtp
  host gmail-smtp-in.l.google.com [209.85.225.27] MX=5
  host alt1.gmail-smtp-in.l.google.com [173.194.76.27] MX=10
  host alt2.gmail-smtp-in.l.google.com [74.125.115.27] MX=20
  host alt3.gmail-smtp-in.l.google.com [173.194.67.26] MX=30
  host alt4.gmail-smtp-in.l.google.com [173.194.65.26] MX=40
someuser@gmail.com
  router = dnslookup, transport = remote_smtp
  host gmail-smtp-in.l.google.com      [209.85.225.27] MX=5
  host alt1.gmail-smtp-in.l.google.com [173.194.76.27] MX=10
  host alt2.gmail-smtp-in.l.google.com [74.125.115.27] MX=20
  host alt3.gmail-smtp-in.l.google.com [173.194.67.26] MX=30
  host alt4.gmail-smtp-in.l.google.com [173.194.65.26] MX=40
search_tidyup called
close MYSQL connection: localhost:(/usr/mailsuite/tmp/mysql.sock)/exim/root

I'm really at a loss here , any help is appreciated.

share|improve this question

2 Answers 2

Exim will not run as root. The default non-root userid it uses is hard-coded as part of the build. In your case it is appears to be exim. Add a user id exim with the group exim and it should run.

EDIT: Missed the scroll bar on the log. Exim appears to be selecting the correct router and DNS lookup succeeded. However, there is no indication that a connection is being established with the remote server. Try using telnet to one or more of the IPs to see if you can connect to the SMTP port. The command

telnet 209.85.225.27 25

Should result in something like the following:

Trying 209.85.225.27...
Connected to 209.85.225.27.
Escape character is '^]'.
220 mx.google.com ESMTP el4si7116293icb.3

The line starting 220 is the one that indicates you have connected to the server. If it succeeds, type QUIT to close the connection. If it does not succeed it is likely you have a firewall preventing outgoing SMTP connections.

share|improve this answer
    
Thanks for your help BillThor. An exim user and group is already present in /etc/passwd file, and exim runs and delivers to local users fine. The problem happens when it tries to send to remote mail servers. –  Tutul Mar 17 '12 at 0:50
    
I could connect manually to external smtp servers with netcat, but exim was unable to, even after the firewall was down. I solved the problem by installing a local dns resolver. Thank you again for your time and patience on this. I upvoted your answer for suggestion regarding the root user. –  Tutul Mar 18 '12 at 4:08

It turned out that the MTAs were unable to resolve DNS records through external DNS resolvers. I installed dnsmasq in the local server and put it as the first entry in my /etc/resolv.conf and both exim and postfix were able to send to remote servers.

share|improve this answer

Your Answer

 
discard

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.