> On Jan 14, 2018, at 8:53 AM, lutz.niede...@gmx.net wrote:
> 
> we are using two external MX servers in separate data centers.  Both of them 
> are running postfix since many years without problems.
>  
> Internally we do have a postfix server as final destination for all domains.  
> On each MX we have defined a relay_transport with specific settings that 
> relay mail to our internal server.  For this we use transport:[A RECORD]:port 
> as relay_transport.
>  
> Now we have two links to our internal server and we observed that it was the 
> right decision to have those two links.  Our internal server got two IP 
> addresses (one per link) and is listening on both of them for connections 
> from the MX servers.  But we have no clue how to set up a secondary 
> relay_transport that kicks in if the primary is offline.  So, currently we 
> cannot use the backup link for incoming mails.  We can only specify one 
> relay_transport entry, means one IP address, with a transport.

Replace the IP address with a hostname:

   main.cf:
        indexed = ${default_database_type}:${config_directory}/
        transport_maps = ${indexed}transport
        relay_host_lookup = dns, native

   transport:
        example.com     relay:[internal.example.com]

   master.cf:
        relay unix ... smtp
          -o smtp_host_lookup=$relay_host_lookup

   /etc/hosts
        # See http://www.linfo.org/etc_host_conf.html
        192.0.2.1       internal.example.com
        192.0.2.2       internal.example.com

This will deliver mail via either address chosen uniformly randomly.
If you need a fallback use MX records:

   main.cf:
        indexed = ${default_database_type}:${config_directory}/
        transport_maps = ${indexed}transport

   transport:
        example.com     relay:example.com.localhost

and configure the local DNS resolver to return MX records for
example.com.localhost:

        ; localhost private zone
        localhost. IN A 127.0.0.1
        example.com.localhost. IN MX 10 relay1.example.com.localhost.
        example.com.localhost. IN MX 20 relay2.example.com.localhost.
        relay1.example.com.localhost. IN A 192.0.2.1
        relay2.example.com.localhost. IN A 192.0.2.2

-- 
        Viktor.

Reply via email to