Setting outgoing IP address for domain in exim4

Posted: 2007-11-26

Thanks to Dave Evans on the exim4 users list for this.

I need to set different IP addresses for different outgoing domains.

Since I only have a few - we took a simple approach

/etc/exim4/interfaces

has lines of the form

domain: ip
domain: ip
domain: ip

Then - in /etc/exim4/conf.d/transport/30exim4-configremotesmtp (or wherever your definition of remotesmtp transport is) add the following to the remote_smtp transport:

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