[exim] Fallback transport with different bind address

Top Page
Delete this message
Reply to this message
Author: Brian Candler
Date:  
To: exim-users
Subject: [exim] Fallback transport with different bind address
I have a server with a regular Internet connection plus a backup
connection via a 4G modem. I have configured policy routing so that if
I bind to the 4G modem interface, traffic goes out of that interface.

# ping 8.8.4.4
PING 8.8.4.4 (8.8.4.4) 56(84) bytes of data.
64 bytes from 8.8.4.4: icmp_seq=1 ttl=59 time=1.94 ms
64 bytes from 8.8.4.4: icmp_seq=2 ttl=59 time=2.73 ms
64 bytes from 8.8.4.4: icmp_seq=3 ttl=59 time=2.28 ms

# ping -I 192.168.15.31 8.8.4.4
PING 8.8.4.4 (8.8.4.4) from 192.168.15.31 : 56(84) bytes of data.
64 bytes from 8.8.4.4: icmp_seq=1 ttl=58 time=127 ms
64 bytes from 8.8.4.4: icmp_seq=2 ttl=58 time=100 ms
64 bytes from 8.8.4.4: icmp_seq=3 ttl=58 time=79.9 ms

What I want to do is to set up this machine as an E-mail relay for
sending out alerts. I want it to do direct delivery over the main
Internet link if possible, but if that fails to deliver over the 4G link
instead.

I'm trying to work out how to implement that in exim. I can see that
it's possible to get a transport to bind to an interface:

remote_smtp_4g:
driver = smtp
interface = 192.168.15.31

but I don't see how to get a failure of one transport (e.g. remote_smtp)
to cause delivery via another transport (e.g. remote_smtp_4g)

I can see that there's a "fallback_hosts" option on the SMTP transport,
but I can't see how to make that bind differently to the normal
connection. This would also require me to have a remote SMTP smarthost,
but that's doable if necessary.

So at the moment, the best I can think of is to use fallback_hosts
pointing to a remote smarthost, plus a static route to send *all*
traffic for that smarthost via the 4g link. Are there any other
possibilities I've overlooked?

Actually, a similar issue problem around DNS failures. I can work around
this by making 8.8.8.8 one of the fallback nameservers in resolv.conf,
and having a static route to 8.8.8.8 via the 4g link.

However, is it possible to handle this in exim? For example, can I
configure the dnslookup router so that if the DNS lookup gives a SRVFAIL
response then it declines rather than defers, and falls through to the
next router?

I found the options "mx_fail_domains" and "srv_fail_domains" which treat
failed SRV and MX record lookups as if they didn't exist. However I
believe exim will fall back to looking up A/AAAA records and I can't see
how to control the behaviour for SRVFAIL there. There is the global
"dns_again_means_nonexist" but that seems pretty crude.

Clues gratefully received...

Thanks,

Brian.