I a building an email server that will use Postfix for SMTP, and Dovecot for IMAP.
This server will have two interfaces:
- wwan0 - this interface has a static public IP address, and will be used by Postfix for sending and receiving email, and Dovecot for remotely acessing IMAP - this interface has a limited usage cap as it is a 3G connection
- wlan0 - this interface has a private IP address assigned by a wifi/ADSL router - this interface will be used by Dovecot for local IMAP, and for remaining non-Postfix outgoing traffic - this interface has a much larger usage cap
My understanding is that I will need to:
- Tell Postfix to only use wwan0 by setting the inet_interfaces main.cf parameter to the public static IP - this should make Postfix only listen on wwan0, and send all outgoing traffic via wwan0
- Set the default gateway to the ADSL router - this should cause all remaining traffic to go via the ADSL
- Set Dovecot to listen on localhost so all interfaces respond to IMAP
A further extension to this would be to explore how to get the default gateway to failover to the wwan0 connection when the ADSL fails (sometimes the ADSL will drop but WiFi and router will stay up but not be able to forward any traffic).
I understand you can have multiple default gateways with different metrics, but I can't see how this would fix the ADSL going down but not the router (since gateway is still routable to but fails to forward the traffic).
I have seen suggestion that using a script that checks if the ADSL is still live (ping or HTTP) and changes the kernel routing table to direct traffic to the best interface.
Is my understanding correct?