I have a 750 acting as a hub for 4 VPN connections. Two VPNs are plain vanilla static to static. The other two are static to dynamic. The first dynamic works fine with the use of a script for dynamically changing policy and peer. The second dynamic script, which is exactly the same as the first, will resolve but not update the peer and policy. I have combined the two scripts below:
:local resolvedIP [:resolve "xxx.dyndns.org"];
/log info "$resolvedIP";
/ip ipsec peer set 2 address="$resolvedIP"
/ip ipsec policy set 2 sa-dst-address="$resolvedIP"
:local resolveIP [:resolve "yyy.dyndns.org"];
/log info "$resolveIP";
/ip ipsec peer set 3 address="$resolveIP"
/ip ipsec policy set 3 sa-dst-address="$resolveIP"
I add the DNS name as comment to the ip ipsec peer, prefixed with a + like “+xxx.dyndns.org” (it is part of a larger script complex that enables and disables dynamic update with different prefix characters). It only makes changes when needed, and it can handle multiple policies per peer.
ipsec peer comments was introduced a while back, but hasn’t found its way into WinBox yet, so add by cli.
I know this is a bit outdated topic, but i need help with this script. My problem is that my destination and source address is dynamic too. I need a script that can update sa-dst-address and sa-src-address too. Can someone wrote another script? It’s urgently needed.