/etc/hosts vs DNS & sendmail

Hi All,

I have a question about how /etc/hosts & DNS work on a solaris 9 box.

When I have entries in /etc/hosts that are not in DNS and I run say nslookup the utility will not find the ip. Put if I ping the entry in /etc/hosts it will find it. Basically I have a box with default sendmail and in /etc/hosts I have a entry with mailhost added to it at the end. nslookup does not find the box ping does and sendmail can't send mail to it and I can not verify that it ever worked correctly.

1) what is up with nslookup no seeing /etc/hosts?

2) can sendmail send to hosts per FQDN listed in /etc/hosts & use a DNS server at the same time?

thanks

-im

[699 byte] By [@whata] at [2007-11-26 17:12:28]
# 1

> When I have entries in /etc/hosts that are not in DNS

> and I run say nslookup the utility will not find the

> ip.

Correct. nslookup and /etc/hosts are controlled by /etc/nsswitch.conf.

Files says to search /etc/hosts.

Anything else says to use that name service.

> Put if I ping the entry in /etc/hosts it will

> find it.

If it is in /etc/hosts and /etc/nsswitch.conf says to search /etc/hosts.

> and in /etc/hosts I have a entry with mailhost added

> to it at the end. nslookup does not find the box ping

> does and sendmail can't send mail to it and I can not

> verify that it ever worked correctly.

Sendmail can be compiled to use or disregard name server lookups in addition to the /etc/nsswitch.conf file.

sendmail -v e-mail_addr, should show you some basic diagnostics.

> 1) what is up with nslookup no seeing /etc/hosts?

That's the way it works.

> 2) can sendmail send to hosts per FQDN listed in

> /etc/hosts & use a DNS server at the same time?

sure, see /etc/nsswitch.conf and the sendmail compile time options.

http://www.ilkda.com/sendmail/

alan

alan.paea at 2007-7-8 23:40:20 > top of Java-index,General,Network Configurations...
# 2

> > When I have entries in /etc/hosts that are not in

> DNS

> > and I run say nslookup the utility will not find

> the

> > ip.

>

> Correct. nslookup and /etc/hosts are controlled by

> /etc/nsswitch.conf.

No. nslookup does not use /etc/nsswitch.conf.

nslookup is a DNS debugging tool and will always use DNS.

If you want a general host lookup tool that does follow the system libraries, use 'getent' instead.

--

Darren

Darren_Dunhama at 2007-7-8 23:40:20 > top of Java-index,General,Network Configurations...
# 3

> > > When I have entries in /etc/hosts that are not

> in

> > DNS

> > > and I run say nslookup the utility will not find

> > the

> > > ip.

> >

> > Correct. nslookup and /etc/hosts are controlled

> by

> > /etc/nsswitch.conf.

>

> No. nslookup does not use /etc/nsswitch.conf.

I should have stated that differently.

thanks,

alan

alan.paea at 2007-7-8 23:40:20 > top of Java-index,General,Network Configurations...