Sendmail, /etc/hosts, & DNS

Brandon D. Hill (
Thu, 17 Jun 1999 19:48:53 +0000

Hello all,

I have a Linux server (behind a firewall) running DNS and acting as
a 'smart' mail host running Sendmail v8.9 for our LAN. Our main SMTP
MTA can recieve mail from the outside, but can't do NS lookups and can't
connect to other MTAs. That's why we need Sendmail. In the DNS, there
is a MX record (public ip-address) for the main MTA, and I also have an
entry in the /etc/hosts file with the private ip-address of the MTA. In
my /etc/nsswitch.conf file, the 'hosts:' line order is: files dns
nisplus nis. The problem is this: when a user sends a message to a
non-existent domain, an error message should get sent back to them
stating the error. The message is generated, but sits in the queue
because the connection to the host was refused. I can't figure out why
the connection is refused, but I do know that it is trying to return the
mail back to the public ip-address. Is there anyway that I can have it
sent back to the private ip-address. If in the file I have
specified the ServiceSwitchFile option to be /etc/nsswitch.conf
shouldn't Sendmail look into the /etc/hosts file first to canonify the
address? It's not. The Sendmail documentation that I have states:

--If "dns" does not appear in that line (referring to the 'hosts:' line
in /etc/nsswitch.conf), sendmail disables lookups of MX records. If
sendmail is configured to look up hosts with nis first, then DNS, it
will do the MX lookup in DNS before the nis lookup.--

Am I to assume that MX lookups are done before everything? Also, if I
just have 'files' in the nsswitch.conf 'hosts:' line, the mail gets
returned but no mail goes out. So, does anyone know of a way to get
Sendmail to look in the /etc/hosts file before the DNS if there is a MX
record present? Any help on this will be much appreciated.


Brandon D. Hill
Michigan Lutheran Seminary
System Administration
2777 Hardin St.
Saginaw, MI 48602-3706

To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to