[TriLUG] Restricting Sendmail to one IP address

Jeremy Portzer jeremyp at pobox.com
Tue Mar 4 12:29:29 EST 2003


On Tue, 2003-03-04 at 12:19, Glenn Meyer wrote:
> I have a server with two IPs on seperate NICs - one internal network - 
> and one internet exposed.  How do I config snedmail to listen only on 
> the internal IP but still be able to send out through the external IP?

Short answer: Set the DAEMON_OPTIONS value in sendmail.mc to the IP
address on the internal NIC.

Longer answer:
You'll probably see something like this in your sendmail.mc already:

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

The "dnl " means that the line is commented out.  Uncomment that line,
and then add a second line for the internal IP, for example:

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

This will make sendmail listen on both the loopback interface and the
internal IP address 192.168.12.34.  You'll have problems if sendmail
doesn't listen on loopback, so don't leave out that part.

After adjusting sendmail.mc, make a backup copy of sendmail.cf, and then
regenerate it with "m4 sendmail.mc > sendmail.cf" .  (Note: some
distributions have sendmail.cf in /etc/mail, in others it's in /etc). 
If you get errors at this step, make sure you have the m4 and
sendmail-cf packages installed.

Then restart sendmail with "/etc/init.d/sendmail restart", and you
should be setup!  Sendmail configuration really can be easy, despite
what people like to say about it.  :-)

Hope this helps,
Jeremy




More information about the TriLUG mailing list