🔌 Router Guides
Mikrotik OS configuration

How to run scripts on multi-WAN scenarios on Mikrotik

2min

+To synchronize 2 or more public IPs, you need to create a Script on Mikrotik with the following lines:

1. 2 WANs

/ip route remove [find comment=ddns_wan] Replace <GATEWAY_WAN2> with the gateway of the second line (WAN). /ip route add dst-address=185.236.104.114 gateway=<GATEWAY_WAN2> comment=ddns_wan In the USER1 and PASS1 fields, enter the user name (username) and password of your account (first network). :tool fetch url="https://ddns.flashstart.com/nic/update?hostname=&myip=&wildcard=NOCHG&username=USER1&password=PASS1" Do the same thing for USER2 and PASS2. PLEASE NOTE: To synchronize the second Public IP you must enter the second network within your Dashboard (NETWORK menu).

:tool fetch url="https://ddns2.flashstart.com/nic/update?hostname=&myip=&wildcard=NOCHG&username=USER2&password=PASS2" Also copy and paste if following lines in order to delete previously created static routes and clear the cache. /ip route remove [find comment=ddns_wan] /ip dns cache flush Below are the scripts to be used in the case of 3 and 4 WANs. PLEASE NOTE:As explained above, you must replace the GATEWAY_WAN,USER and PASS fields with your own data.

2. 3 WANs

/ip route remove [find comment=ddns_wan] /ip route add dst-address=185.236.104.114 gateway=<GATEWAY_WAN2> comment=ddns_wan /ip route add dst-address=185.236.104.124 gateway=<GATEWAY_WAN3> comment=ddns_wan :tool fetch url="https://ddns.flashstart.com/nic/update\?hostname=&myip=&wildcard=NOCHG&username=USER1&password=PASS1" :tool fetch url="https://ddns2.flashstart.com/nic/update\?hostname=&myip=&wildcard=NOCHG&username=USER2&password=PASS2" :tool fetch url="https://ddns3.flashstart.com/nic/update\?hostname=&myip=&wildcard=NOCHG&username=USER3&password=PASS3" /ip route remove [find comment=ddns_wan] /ip dns cache flush

3.4 WANs

/ip route remove [find comment=ddns_wan] /ip route add dst-address=185.236.104.114 gateway=<GATEWAY_WAN2> comment=ddns_wan /ip route add dst-address=185.236.104.124 gateway=<GATEWAY_WAN3> comment=ddns_wan /ip route add dst-address=185.236.104.134 gateway=<GATEWAY_WAN4> comment=ddns_wan :tool fetch url="https://ddns.flashstart.com/nic/update\?hostname=&myip=&wildcard=NOCHG&username=USER1&password=PASS1" :tool fetch url="https://ddns2.flashstart.com/nic/update\?hostname=&myip=&wildcard=NOCHG&username=USER2&password=PASS2" :tool fetch url="https://ddns3.flashstart.com/nic/update\?hostname=&myip=&wildcard=NOCHG&username=USER3&password=PASS3" :tool fetch url="https://ddns4.flashstart.com/nic/update\?hostname=&myip=&wildcard=NOCHG&username=USER4&password=PASS4" /ip route remove [find comment=ddns_wan] /ip dns cache flush Finally, you need to create a Scheduler to automatically run the Script, for example, every minute. From your Dashboard, in the NETWORKS menu, you can check the status of your various networks. If everything is working properly you should see the various Public IPs and synchronization status.



Other ways to ask: » How to run scripts on multi-WAN scenarios in Mikrotik. » Running scripts on multi-WAN scenarios in Mikrotik. How to handle them.