[exim] Setting outgoing IP address for virtual hosts

Top Page
Delete this message
Reply to this message
Author: net_exim4.org
Date:  
To: exim-users
Subject: [exim] Setting outgoing IP address for virtual hosts
I've got a machine running exim4 with one main IP and 5 IP aliases on
the same interface.

The exim config is set up with virtual domains as follows:

domainlist local_domains =
@:localhost:dsearch;/etc/exim4/virtual:dsearch;/var/mail/virtual

/etc/exim4/virtual has a set of files - one per domain with the virtual
user maps set up. Mostly these are forwards offhost - or in some cases
to name@localhost

/var/mail/virtual - a set of directories per host - for local users that
are not actual system users.

Now - I was reading

http://lists.exim.org/lurker/message/20061217.130120.ab8d6800.en.html#exim-users

Specially the

remote_smtp:
driver = smtp
interface = ${lookup {$sender_address_domain} your_lookup {...}}


I'd really like to figure out this interface line - the your_lookup bit.

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.


Some examples:

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

wegner.no has MX of family.chrissearle.org which has IP of 78.47.168.122

and lastly - hunnor.net I am not the MX for but can send as - I'd like
that to go out from the main IP - 88.198.38.80 (this is a catchall for
all the sites that are not listed under /var/mail/virtual).

I'm not so hot at exim config - if I could get some pointers on how to
structure this I'd really appreciate it :)