Forcing sendmail to use /etc/hosts before using DNS

Jim Scott jscott at INFOCONEX.COM
Tue Jan 14 17:14:05 GMT 2003

on the mailscanner servers put an entry like this in your /etc/mail/mailertable
Now any email that these two servers receive destined for will be
directed to the server

make sure you take the entry out of the /etc/mail/local-host-names file and remove
the entry for domain
Make sure you have something in the /etc/mail/local-host-names file on to tell it that it accepts email for the domain

of course you probably also need to add your MX records to point to your mailscanner
servers for this domain as well.

Atleast this is what I think you are trying to do ;-)

Email me privately if you need more help.


----- Original Message -----
From: "Ewald Beekman" <E.H.Beekman at AMC.UVA.NL>
Sent: Tuesday, January 14, 2003 8:49 AM
Subject: Re: Forcing sendmail to use /etc/hosts before using DNS

Probably you can use the mailertable feature to accomplish this,
make sure the feature is enabled in :
FEATURE(`mailertable',`hash -o /etc/mail/mailertable.db')dnl

and create /etc/mail/mailertable with something like:      esmtp:[]

do a makemap
makemap -v hash mailertable < mailertable

and a kill -HUP of your sendmail process:
kill -HUP `head -1 /var/run/`

you can always check where sendmail is going to send stuff with the
-bv option:
/usr/lib/sendmail -bv myuser at

have fun!

On Mon, Jan 13, 2003 at 01:50:15PM -0700, John B. Hanks wrote:
> I am trying to get sendmail/mailscanner to do something that has me
> questioning my understanding of the way this has been working. Here is what
> I currently do to scan mail for a mail server.
> My MailScanner machines are and
> If I want to scan mail for, I go to that DNS record and
> add
>  in mx  10
>  in mx  10
> This has been working flawlessly for some time. I think what happens is mail
> gets delivered to the MailScanner machines, they recognize themselves as MX
> hosts and then forward the scanned mail to the A record for the target.
> Now I need to do some magic for a server move. I have a host,
>, that wants mail scanned and delivered to another box
> which will host mail but still has other functions so it
> need to keep this name in its a record. I thought I could accomplish this by
> adding entries to /etc/hosts on the mailscanners like
> So that when noturus or ameiurus looked up they would use
> the entry from the hosts file and unwittingly deliver mail to the new
> server. But, sendmail seems intent on ignoring the /etc/hosts file. I have
> changed /etc/resolv.conf, /etc/nsswitch.conf, /etc/host.conf and
> /etc/mail/services.switch so that all these point to files first, then dns
> but it still isn't working. The ping command works as expected, checking
> /etc/hosts and using the IP address from the file. Can someone tell me if
> what I want to do is possible and if so, how do I get sendmail to behave
> this way? As we move more mailservers to use MailScanner this is going to
> come up again and I need a way to solve it.
> This is Redhat 7.3, MailScanner 4.11-1 and sendmail 8.11.6-15.
> Thanks,
> jbh

Ewald Beekman, Security Engineer, Academic Medical Center,
dept. ADB/ICT Computer & Network Services, The Netherlands
## Your mind-mint is:
God help the troubadour who tries to be a star.  The more that you try
to find success, the more that you will fail.
                -- Phil Ochs, on the Second System Effect

More information about the MailScanner mailing list