Best way to change route distance & DNS server entries

Hi,

MikroTik details: RB532, v3.3.

I found this simple script to check to see if a host is available through a certain gateway, and then to change the distance on that gateway so the next one will take over. (Would it be easier to use Netwatch with this?). Both are run at an interval, by Scheduler. (I haven’t tried using these yet, because I have one question).

I found it here - http://wiki.mikrotik.com/wiki/Improved_Netwatch_II

Script 1

:local i 0; {:do {:set i ($i + 1)} while (($i < 5) && ([/ping XXX.XXX.XXX.XXX interval=3 count=1]=0))};
       :if ($i=5 && [/ip route get [find comment="Default Route"] distance]=1) do={:log info "Main Gateway down"; 
        /ip route set [find comment="Default Route"] distance=3}

Script 2

:local i 0; {:do {:set i ($i + 1)} while (($i < 5) && ([/ping XXX.XXX.XXX.XXX interval=3 count=1]=1))}; 
      :if ($i=5 && [/ip route get [find comment="Default Route"] distance]=3) do={:log info "Main Gateway up"; 
      /ip route set [find comment="Default Route"] distance=1}

…where XXX.XXX.XXX.XXX is the host you are pinging.

Now, is there any way to change the DNS server entries at the same time? The two gateway end-points are a couple thousand miles apart (VSAT vs ADSL), as are the DNS servers.

I don’t know scripting at all, so I would appreciate any help.

Thanks!

The router automatically uses whichever DNS server is faster.

Can I have more than 2 DNS servers at a time? With both ISPs, I have two DNS servers. I’m guessing it won’t be a big deal, but I just want to make sure.

Thanks for the help though.