Need help WAN Failover between two ISP

Hi i have two ISP and I want to configure failover between them but problem is that their DNS are different form each other so if one link down then other is not working with pervious DNS.

Plz give me any idea or script so that when ISP change then DNS are also changed or any other idea

Configure your DNS services to use 8.8.8.8 and 4.2.2.2 as these are both publicly-available DNS servers hosted by Google and by Level3.

If you want to use your ISP’s DNS servers for any special reason, then you’ll need to set up dstnat rules in your NAT section of the ip firewalls configuration.

(pseudo configuration info here)
I think the mark rules should be on the postrouting chain.
set a mangle table rule that packet marks udp port 53 going out ISP1 interface with a mark (e.g. DNS1)
set another mangle table rule that marks the same packets going out ISP2 interface with a different mark (e.g. DNS2)

Then in the NAT table, in the dstnat chain, match packets with mark DNS1 and set dst address to ISP1 dns server
Match mark DNS2 and set dst address to ISP2 dns server.

{note, this is off the top of my head, and I’m thinking that you may not be able to do DSTnat after routing decisions have been made, but that’s the gist of the solution 2 - I recommend just using public ones as it is the most straightforward - no use over-complicating something that can be simple}

Thanks for giving me IDea. Its help full for me. :slight_smile: