---
title: How to run scripts on multi-WAN scenarios on Mikrotik
slug: legacy/how-to-run-scripts-on-multi-wan-scenarios-on-mikrotik
description: Learn how to effectively synchronize multiple public IPs on a MikroTik router with our step-by-step guide. This document covers essential scripts for managing routing and DNS updates for each WAN connection. 
docTags: 
createdAt: 2024-02-05T13:06:42.769Z
---

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

*WANs&#xD;*
-----------

*/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=[link](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=[link](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]&#x20;/ip dns cache flush*

Below are the scripts to be used in the case of 3 and 4 WANs.

**PLEASE NOTE:&#x20;**&#x41;s explained above, you must replace the *GATEWAY\_WAN,USER* and *PASS* fields with your own data.

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=[link](https://ddns.flashstart.com/nic/update\\?hostname=\&myip=\&wildcard=NOCHG\&username=USER1\&password=PASS1)

\:tool fetch url=[link](https://ddns2.flashstart.com/nic/update\\?hostname=\&myip=\&wildcard=NOCHG\&username=USER2\&password=PASS2)

\:tool fetch url=[link](https://ddns3.flashstart.com/nic/update\\?hostname=\&myip=\&wildcard=NOCHG\&username=USER3\&password=PASS3)

*/ip route remove \[find comment=ddns\_wan]&#xD;*&#xA;*&#xD;/ip dns cache flush*

## WANs

*/ip route remove \[find comment=ddns\_wan]&#xD;*&#xA;*&#xD;*&#xA;*&#xD;/ip route add dst-address=185.236.104.114 gateway=\<GATEWAY\_WAN2> comment=ddns\_wan&#xD;*&#xA;*&#xD;*&#xA;*&#xD;/ip route add dst-address=185.236.104.124 gateway=\<GATEWAY\_WAN3> comment=ddns\_wan&#xD;*&#xA;*&#xD;*&#xA;*&#xD;/ip route add dst-address=185.236.104.134 gateway=\<GATEWAY\_WAN4> comment=ddns\_wan*

\:tool fetch url=[link](https://ddns.flashstart.com/nic/update\\?hostname=\&myip=\&wildcard=NOCHG\&username=USER1\&password=PASS1)
\:tool fetch url=[link](https://ddns2.flashstart.com/nic/update\\?hostname=\&myip=\&wildcard=NOCHG\&username=USER2\&password=PASS2)
\:tool fetch url=[link](https://ddns3.flashstart.com/nic/update\\?hostname=\&myip=\&wildcard=NOCHG\&username=USER3\&password=PASS3)
\:tool fetch url=[link](https://ddns4.flashstart.com/nic/update\\?hostname=\&myip=\&wildcard=NOCHG\&username=USER4\&password=PASS4)

*/ip route remove \[find comment=ddns\_wan]&#xD;*&#xA;*&#xD;/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.

