🔌 Guias de roteador
Configuração do sistema operat...

Como executar scripts em cenários multi-WAN no Mikrotik

2min

Para sincronizar 2 ou mais IPs públicos, você precisa criar um script no Mikrotik com as seguintes linhas:

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 Finalmente, é necessário criar um Agendador para executar automaticamente o Script, por exemplo, a cada minuto. A partir do seu Dashboard, no menu NETWORKS, pode verificar o estado das suas várias redes. Se tudo estiver a funcionar corretamente, deverá ver os vários IPs públicos e o estado da sincronização.



Outras maneiras de perguntar: » Como executar scripts em cenários de múltiplas WAN no Mikrotik. » Executando scripts em cenários de múltiplas WAN no Mikrotik. Como gerenciá-los.