Looking for a script to update 2 public dynamic IP

Good morning:

I currently have two ISPs set up on my Mikrotik. Both providers give me a dynamic public IP. I have IP Cloud enabled so that it updates my IP when it changes. But with IP Cloud, only the IP of a single ISP that is connected on the eth1 port is updated. How can I capture the IP change of the second ISP that is on the eth2 port. Does anyone have a script for this. Thanks for any help.

You can retrieve public IP from https://api.ipify.org using fetch tool.
Add api.ipify.org into address list and create 2 disabled mangle rules to mark routing for each route which will have created address list in dst list.
In script first enable mangle rule for routing over eth1, retrieve public IP with fetch tool, disable first rule, enable second rule, use fetch tool again to retrieve public IP from eth2 and then disable second rule.
Just a proposition, didn’t try it, maybe there is a better way to achieve this…

Thanks for the idea. I will try that option.

This is part of a script I use for updating DDNS and the scheduler entry, I believe this fits your use case.

Script CheckIP
:local WANInter "ether1"

Get the current IP on the interface

:local currentIP [/ip address get [find interface="$WANInter" disabled=no] address]

Strip the net mask off the IP address

:for i from=( [:len $currentIP] - 1) to=0 do={
:if ( [:pick $currentIP $i] = "/") do={
:set currentIP [:pick $currentIP 0 $i]
}
}

/system scheduler add comment="Check for IP change" interval=5m name=CheckIPchange
on-event="/system script run CheckIP\r\n" policy=read,write,test start-time=startup disabled=no

:global currentIP
    :local newIP [/ip address get [find where interface="ether2"] address]
    :set newIP [:pick $newIP 0 [:find $newIP "/" -1]]
    :if ($newIP != $currentIP) do={
    :set currentIP $newIP}

I use this script, I hope it helps you friend.

Recursive dynamic IP Routes. - http://forum.mikrotik.com/t/ha-isp-recursive-routing-isp-failover-using-dhcp/166614/1

Hi, I try that but does’t work, the var is emty.

Late i have this and was working fine

:delay 5000ms;
:local dirIP ([:pick [/ip address print as-value where interface="pppoe-out1"] 0]->"address")
#:put $dirIP
:log info ("Nueva IP de ANTEL $dirIP")
/tool e-mail send to=MiEmail@gmail.com  subject=Router_New_IP  body="Router_New_IP is $dirIP

I test only the second line to test it.

I thing that stop working on the 7 OS Update.
Some one has the same problem?