Router Guides
MikroTik RouterOS Configuratio...
How to run scripts on multi-WAN scenarios on Mikrotik
6 min
overview to synchronize two or more public ips simultaneously, you need to create a dedicated script on your mikrotik device the scripts below create static routes to force the update through the correct gateway and then safely clear the dns cache before proceeding, you must add a distinct dynamic network for each wan connection directly inside your dashboard networks menu variables to replace before pasting any script into your terminal, carefully replace the placeholder data with your actual parameters gateway wan2, gateway wan3 replace these tags with the actual gateway ip address of your secondary lines user1, pass1 enter the specific username and password assigned to your first dynamic network user2, pass2 enter the specific username and password assigned to your second dynamic network do this for all subsequent credentials if your dynamic network password contains special characters like $ or ", you must insert the \ symbol before each of those characters in the code scenario two wans copy and paste the following code to handle two internet lines routeros /ip route remove \[find comment=ddns wan] /ip route add dst address=185 236 104 114 gateway=\<gateway wan2> 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" /ip route remove \[find comment=ddns wan] /ip dns cache flush scenario three wans copy and paste the following code to handle three internet lines routeros /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 scenario four wans copy and paste the following code to handle four internet lines routeros /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 finalizing and testing finally, you need to create a scheduler in your mikrotik system to automatically run your chosen script at regular intervals like every minute from your dashboard, open the networks menu to check the status of your various connections if everything is configured correctly, you should see the different public ips and their active synchronization status