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

Pàgina inicial
Delete this message
Reply to this message
Autor: Chris Searle
Data:  
A: Dave Evans
CC: exim-users
Assumpte: Re: [exim] Setting outgoing IP address for virtual hosts

On 26. nov. 2007, at 13.45, Dave Evans wrote:

> 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.


Yes - I did spot that. Will get a look later on. Its most likely that
I thought that mail. was an A record while I was configuring up the
new IP aliases (this is a box that was migrated from a single IP box
to this one with 1 + 5 aliases).

>> 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.


I was thinking of a "get the IP of the MX for the domain that is
sending the current mail - if it is this box then use it else
88.198.38.80)


> 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


This approach is also fine - I only have a few domains - so it really
doesn't have to be fancy :)

>
> 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"?


I think this will work just fine. I have something like 8 domains to
worry about - so I can't be bothered with full automation.

I need to read again on the semantics of the lookup call here - we're
saying - grab the sender_address_domain from the mail, look in the
file /etc/exim4/interfaces (lsearch) and use whatever value is found
($value) and if nothing is found then use the 88.x IP ?

Before I go in and change this - is there any easy way to test this
from the command line with exim4 -sometestingoptions ?

Trouble is - exim4 simply "just works" so much of the time I never
remember how to test ;)

Chris Searle
net_exim.org@???