localhost name resolution problem

W. Sierke ws at senet.com.au
Tue Apr 1 08:10:20 PST 2003


From: "Ryan Merrick" <sandshrimp at attbi.com>
> W. Sierke wrote:
> >hosts contains
> >::1 localhost.my.domain localhost
> >127.0.0.1 localhost.my.domain localhost
> >192.168.100.1 this_machine.my.domain this_machine
> >192.168.100.2 another_machine.my.domain another_machine
> >...
>
> Your #/etc/hosts file should read for IPv4 localhost
> 127.0.0.1    localhost.Your_local_domain.com localhost
>
> There should be another line in #/etc/hosts your host
> 192.168.100.1    My_host.Your_local_domain.com My_host
>
> You can add as many lines as you want. with IP address, hostname,
nickname.

Indeed, but despite the presence of the (IPv4) localhost entry, sendmail was
resolving localhost to my internet IP address, rather than 127.0.0.1.

It was suggested to me that the name resolution method that sendmail uses
would not use /etc/hosts anyway and since that matched my own experience I'm
inclined to think it's true, that's why I resorted to adding bind to the
system.

After further investigation I've seen two approaches to resolving this
issue, one to substitute 127.0.0.1 in place of 'localhost' in the sendmail
config files[1], the other to add the sendmail config file
/etc/mail/service.switch with the line "hosts files dns".

But now I'm curious about why these options aren't used in the default
installation of sendmail on FreeBSD, given that my situation doesn't appear
to be unusual. Does sendmail not use the hosts file by default as a security
measure? In any case it just feels "dirty" to me to have to circumvent this
issue on a case-by-case basis - i.e. my thinking at the moment is that a dns
facility should resolve 'localhost' correctly. Is that a shared sentiment?
Or am I just barking up the wrong tree altogether?


Thanks,

Wayne

[1] - by having FEATURE(`msp', `[127.0.0.1]') in submit.mc



More information about the freebsd-questions mailing list