Re: [exim] Setting outgoing IP address for virtual hosts

Top Page
Delete this message
Reply to this message
Author: Dave Evans
Date:  
To: net_exim4.org
CC: exim-users
Subject: Re: [exim] Setting outgoing IP address for virtual hosts
On Mon, Nov 26, 2007 at 01:01:32PM +0100, net_exim4.org@??? wrote:
> chrissearle.org has MX of mail.chrissearle.org which is in turn a CNAME
> to personal.chrissearle.org and has IP of 78.47.168.125


You'll want to fix that - MXs aren't allowed to be CNAMEs. You should
probably either set the MX to "personal.chrissearle.org", or change
mail.chrissearle.org from a CNAME to a plain old "A" record.

> What I would like to set up is that for all domains that I can
> send/receive - use the IP address of the relevant domain's MX.
>
> For any that I only send as (the machine is also a webserver for some
> domains for which it is not the MX - for these it sends mail for cron
> jobs etc) - send as the machines main IP.
>
> Of note is that the MX records for the virtual domains are not
> necessarily under the same domain name.


I'm unclear as to the logic you want of how to know what IP address to use for
each domain.

Something like this (untested) should work:

interface = ${lookup{$sender_address_domain}lsearch{/etc/exim4/interfaces} {$value}{88.198.38.80}}

where /etc/exim4/interfaces lists domain-to-IP mappings like this:

chrissearle.org: 78.47.168.125
wegner.no: 78.47.168.122

and 88.198.38.80 is your "default" IP address for domains not listed in that
file (including any "bounce" messages you might happen to send).

Is that the sort of thing you were after, or did you want something a bit more
"automatic"?

--
Dave Evans
http://djce.org.uk/
http://djce.org.uk/pgpkey