Failover two IP addresses and one DNS record

23,957

Solution 1

  1. Create an A record with public IP address over WAN interface 1 to, say, mail.something.com
  2. Create an A record with public IP address over WAN interface 2 to same name, mail.something.com
  3. Create an MX record to mail.something.com

You have to have two A records which can hold both public IPs over a single FQDN, and then a Mail Exchanger (MX) record to point that FQDN. This way you're actually doing an IP load balancing, not a fail-over. Don't forget to create PTR records for those two public IP addresses, both should point back to mail.something.com, in order to some mail servers deny to communicate with mail server which don't have PTR records.

Solution 2

Not quite sure what your setup actually is, but

  1. two WANs, your own AS: Assign both WAN interfaces the same IP, then ask your routing providers to add a neighbor fall-over or a fast-external fall-over to your edge routers, then have your one A record resolve to the one IP address.

    Now the edge routers will monitor the route to your WAN interfaces and communicate any failures to each other

  2. two WANs, not your own AS or two assigned IP addresses: technically you could also add some BGP fall-overs but since this is not your own AS you would have to ask the AS owner(s) to do the setup in 1 for you (which can be difficult if it's two owners)
  3. two WANs, two IP addresses, no failovers at the BGP level: You can always assign two A-records to one and the same hostname, then clients would resolve to one of the two addresses and (after a possibly long timeout) might try the other
Share:
23,957

Related videos on Youtube

Tobia
Author by

Tobia

Updated on September 18, 2022

Comments

  • Tobia
    Tobia almost 2 years

    My mail server has two WAN interfaces and I need to set up one DNS A record for my Exchange clients. In case of connection failure of one interface I wish to use the other interface, but how to set up a DNS record to let the client choose the working one? Something like happends with MX10/MX20 record for SMTP connections.

  • Tobia
    Tobia over 10 years
    I can not add the same ip, this two WAN interfaces has two different providers and two different subnets
  • Tobia
    Tobia over 10 years
    What happends if a wan interface fails? Clients will balanced between a working wan and a not working wan or usually clients try the other record like mx protocol?
  • hroptatyr
    hroptatyr over 10 years
    well then it's option 2 or 3 it seems, depending on the level of failover you want
  • Hasan Manzak
    Hasan Manzak over 10 years
    The is no "other record" from client perspective, because there is only one MX record. Clients will be trying to connect to that failed wan and fail to connect, try again from the beginning which is name resolution query to DNS server. DNS server handles which answer it'll return.