IPSec updater with 2 dynamic addresses.

I am just making some minor mistake I am sure…

I need to make a global variable. I want to call it LocalSite
I want the script to get the IP address from actual-interface=ether10

:global LocalSite [:ip address actual-interface=ether10]

What am I missing?

See Second post from me.

:global localSite [/ip address get [find interface=“2-dmz”] address]
:env print
“localSite”=“10.40.4.1/24”

You will need to handle if there are more than 1 ip address on an interface, it will give an error if so.

Thanks… but its giving me output with the subnet on it.

Edit…

What I was trying to do was make a script to update my IPSec info… after a ton of messing with it.. this works on 5.17.
(I use the often seen dyndns update script. That gives me $previousIP.)

Script

:global previousIP
:global RemoteSite [:resolve site2.example.net]
/ip ipsec peer set 0 address=“$RemoteSite”
/ip ipsec policy set 0 sa-src-address=“$previousIP”
/ip ipsec policy set 0 sa-dst-address=“$RemoteSite”