# sendmail:  host name lookup failure

## justin_brody

Hi,

I'm trying to get sendmail going on my gentoo box.  It seems to be doing fine delivering local mail, but delivering to outside addresses doesn't.  It either gives me a host name lookup failure error; or it seems to try to relay through the localhost which doesn't work.  Relevant lines of /var/mail/log:

Oct  3 17:51:12 sunya sendmail[28702]: j93LpCG7028702: Authentication-Warning: sunya.zero.

net: justin set sender to br@math.umd.edu using -f

Oct  3 17:51:12 sunya sendmail[28702]: j93LpCG7028702: from=br@math.umd.edu, size=64, c

lass=0, nrcpts=1, msgid=<200510032151.j93LpCG7028702@sunya.zero.net>, relay=justin@localho

st

Oct  3 17:51:12 sunya sm-mta[28708]: j93LpCSI028708: from=<br@math.umd.edu>, size=375, 

class=0, nrcpts=1, msgid=<200510032151.j93LpCG7028702@sunya.zero.net>, proto=ESMTP, daemon

=MTA, relay=sunya.zero.net [127.0.0.1]

Oct  3 17:51:12 sunya sendmail[28707]: j93LpCG7028702: to=jdbr@gmail.com, delay=00:00:0

0, xdelay=00:00:00, mailer=relay, pri=120064, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, st

at=Sent (j93LpCSI028708 Message accepted for delivery)

Oct  3 17:51:52 sunya sm-mta[28710]: j93LpCSI028708: to=<jdbr@gmail.com>, delay=00:00:4

0, xdelay=00:00:40, mailer=relay, pri=120375, relay=smtp.comcast.net, dsn=4.0.0, stat=Defe

rred: Name server: smtp.comcast.net: host name lookup failure

Here's my sendmail.mc:

divert(-1)

divert(0)dnl

include(`/usr/share/sendmail-cf/m4/cf.m4')dnl

VERSIONID(`$Id: sendmail-procmail.mc,v 1.2 2004/12/07 01:59:31 g2boojum Exp $')d

nl

define('confDEF_USER_ID',"8:12")dnl

OSTYPE(`linux')dnl

DOMAIN(`generic')dnl

define(`SMART_HOST', `smtp.comcast.net')dnl

MASQUERADE_AS(comcast.net)dnl

FEATURE(`allmasquerade')dnl

FEATURE(`masquerade_envelope')dnl

define(`PROCMAIL_MAILER_PATH',`/usr/bin/procmail')dnl

FEATURE(`smrsh',`/usr/sbin/smrsh')dnl

FEATURE(`local_lmtp',`/usr/sbin/mail.local')dnl

FEATURE(`local_procmail')dnl

define(`PROCMAIL_MAILER_FLAGS',`procmail -Y -m $h $g $u')dnl

define(`PROCMAIL_MAILER_ARGS',`procmail -Y -m $h $g $u')dnl

DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

MAILER(procmail)dnl

MAILER(local)dnl

MAILER(smtp)dnl

Cwlocalhost

And /etc/hosts:

127.0.0.1       sunya.zero.net sunya localhost 

Don't really know what I'm doing - any help would be greatly appreciated!

Thanks,

Justin

----------

## Pete M

Justin

From your logs you seem to have a DNS issue

 *Quote:*   

> Name server: smtp.comcast.net: host name lookup failure 

 

Do you have valid nameserver entries in /etc/resolv.conf

To test your nameservers "emerge bind-tools" then on the command line as root try

```
# dig smtp.comcast.net

; <<>> DiG 9.2.5 <<>> smtp.comcast.net

;; global options:  printcmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 18492

;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 3, ADDITIONAL: 0

;; QUESTION SECTION:

;smtp.comcast.net.              IN      A

;; ANSWER SECTION:

smtp.comcast.net.       900     IN      A       216.148.227.125

smtp.comcast.net.       900     IN      A       63.240.76.27

smtp.comcast.net.       900     IN      A       204.127.198.27

smtp.comcast.net.       900     IN      A       204.127.202.27

;; AUTHORITY SECTION:

comcast.net.            7200    IN      NS      dns01.jdc01.pa.comcast.net.

comcast.net.            7200    IN      NS      dns02.jdc01.pa.comcast.net.

comcast.net.            7200    IN      NS      adns.cmc.comcast.net.

;; Query time: 366 msec

;; SERVER: 192.168.0.3#53(192.168.0.3)

;; WHEN: Tue Oct  4 08:15:36 2005

;; MSG SIZE  rcvd: 170

```

This is the reply I get

Also as a side note to receive incoming mail you need to comment out this line

```
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl 
```

Make it like this

```
dnl # DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
```

This makes sendmail listen on all interfaces not just your loopback

Pete

----------

## justin_brody

Hi Pete,

Thanks for your response.  Here's what I get from dig:

```

sunya justin # dig smtp.comcast.net

; <<>> DiG 9.2.5 <<>> smtp.comcast.net

;; global options:  printcmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26447

;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:

;smtp.comcast.net.              IN      A

;; ANSWER SECTION:

smtp.comcast.net.       566     IN      A       204.127.202.27

smtp.comcast.net.       566     IN      A       216.148.227.125

smtp.comcast.net.       566     IN      A       63.240.76.27

smtp.comcast.net.       566     IN      A       204.127.198.27

;; Query time: 39 msec

;; SERVER: 68.87.64.196#53(68.87.64.196)

;; WHEN: Tue Oct  4 12:57:00 2005

;; MSG SIZE  rcvd: 98

```

Which I gather is similar to what you have without the authority entires?

In case it helps, here's my resolv.conf

```
sunya justin # cat /etc/resolv.conf

nameserver 68.87.64.196

nameserver 68.87.66.196

nameserver 68.48.0.12

search hsd1.md.comcast.net.

```

(This is created via DHCP).

Poking around a bit, it looks like the MX record isn't working though:

```
sunya justin # nslookup 

> set type=mx

> smtp.comcast.net

Server:         68.87.64.196

Address:        68.87.64.196#53

Non-authoritative answer:

*** Can't find smtp.comcast.net: No answer

Authoritative answers can be found from:

comcast.net

        origin = dns01.jdc01.pa.comcast.net

        mail addr = dnsadmin.comcast.net

        serial = 1348

        refresh = 900

        retry = 180

        expire = 604800

        minimum = 3600

```

Which seems strange, since my nameservers are from comcast.  But then, I don't really know how this works.  Is this a problem on their end?

For what it's worth, the same basic setup seemed to work fine a few weeks ago.  I had a harddrive crash and had to reinstall GENTOO; but relaying through smtp.comcast.net did seem to work then...

Any ideas?

----------

## justin_brody

Well, I followed the example at http://davespicks.com/writing/programming/sendmailhostlookupfailure.html and this seems to work for me.  Can anyone verify that the actualy problem is that Comcast doesn't have an MX entry for their own mail server???

-Justin

----------

## Pete M

Justin

Try it this way using square brackets this will prevent sendmail doing a MX lookup

```
define(`SMART_HOST', `[smtp.comcast.net]')dnl
```

Sendmail by default connects to port 25 and I have already tried

```
# telnet smtp.comcast.net 25
```

And it connects perfectly to comcasts mail server

Pete

----------

## Pete M

Sorry Justin 

Did'nt read your post, been doing something else, glad you solved it

Pete

----------

