Please add this feature on RouterOS
it does the trick tho, but prebuilt Fetch options should be better
Code: Select all
# resolve IP address
:foreach o in={"some.url1.com"; "some.url2.com"} do={
/ip firewall address-list add list=myurl address=$o timeout=15s
:delay 3;
# get resolved (dynamic) IP from url above
:foreach p in=[/ip firewall address-list find comment=$o dynamic=yes] do={
:local addr [/ip firewall address-list get $p address];
# add routes to specific interface/gateway
/ip route add gateway=$gw dst-address=$addr comment=to-isp2
}
}
.....
# clear custom routes after fetch done
/ip route remove [find where comment=to-isp2]