Sendmail and network aliases

Giorgos Keramidas keramida at ceid.upatras.gr
Mon Nov 20 10:55:31 PST 2006


On 2006-11-12 21:16, Evgeniy Belomestnov <belomestnov at mac.com> wrote:
> Hello!
> 
> I have FreeBSD-6.1 machine with two network interfaces: one for
> private network, one for internet. Network interface for
> internet has some aliases. I need to configure mail relay for
> some domains at this computer. Can I configure my MTA
> (Sendmail) to send outgoing e-mail for different domains via
> particular network interface but with different IP-addresses
> (aliases). For example, to send e-mail for DOMAIN1 via
> INTERFACE1.ALIAS1, for DOMAIN2 via INTERFACE1.ALIAS2, for
> DOMAIN3 via INTERFACE1.ALIAS3 and so on.

On 2006-11-19 12:34, Evgeniy Belomestnov <belomestnov at mac.com> wrote:
> Hello!
> 
> I have FreeBSD-6.1 machine with two network interfaces: one for
> private network, one for internet. Network interface for
> internet has some aliases. I need to configure mail relay for
> some domains at this computer. Can I configure my MTA
> (Sendmail) to send e-mail for different domains via particular
> network interface but with different IP-addresses (aliases)?
> For example, to send e-mail for DOMAIN1 via INTEREFACE1.ALIAS1,
> for DOMAIN2 via INTERFACE1.ALIAS2, for DOMAIN3 via
> INTERFACE1.ALIAS3 and so on.

Hi Evgeniy,

I'm not sure I understand the original question, and I have
stared at the first copy of this post for quite a while (I still
had it in my INBOX, when you reposted today).

If I understand correctly what you want to do, you can use the
`mailertable' feature of Sendmail.  An example of how this
feature works is described below:

When my laptop is connected through our internal network at work,
I want to send all outgoing email messages to my default SMTP
AUTH account, but still forward all the work-related email to our
internal SMTP server.

This means that, depending on the recipient address of each
message, I want it to go to:

    smtp.relay.host
    mail.company.com

To set this up, I have in my `/etc/mail/sendmail.mc' file the
lines:

    dnl All outgoing email is sent to `smtp.relay.host' through the
    dnl `relay' mailer.  Exceptions, i.e. for any domains which need
    dnl special handling, use `esmtp' or another mailer, through
    dnl `mailertable'.
    define(`SMART_HOST', `smtp.relay.host')
    define(`RELAY_MAILER_ARGS', `TCP $h 587')
    
    dnl Instead of putting all the SMTP AUTH credentials in `access',
    dnl I like using a separate map for this.  The `authinfo' feature
    dnl works fine for this:
    FEATURE(`authinfo', `hash /etc/mail/authinfo')
    
    dnl Allow mail routing exceptions through a mailer table.
    FEATURE(`mailertable', `hash /etc/mail/mailertable')

Then, in my `/etc/mail/mailertable' file I have an entry for the
domain of our company:

    # Custom mail routing rules.
    
    company.com             smtp:mail.company.com
    .company.com            smtp:mail.company.com

You can have an arbitrary number of entries in your `mailertable'
file.  For more details, look at the Sendmail README file for a
description of this feature:

    /usr/share/sendmail/cf/README

or to the online documentation of Sendmail, at:

    "Sendmail cf/README - Using Mailertables"
    http://www.sendmail.org/m4/mailertables.html

I hope this helps a bit,

- Giorgos



More information about the freebsd-questions mailing list