If it exists, I'm trying to put a VPN remote address in a variable but am not finding how to do it in documentation.
I can get the following info using console commands but don't know how to get the remote-address into a variable:
Code: Select all
/ip ipsec active-peers> print
Flags: R - responder, N - natt-peer
# ID STATE UPTIME PH2-TOTAL REMOTE-ADDRESS DYNAMIC-ADDRESS
0 N x.x.x.x established 21m35s 1 x.x.x.x
I also need to know when the VPN is not active, i.e. nil (missing) remote-address, like this at the console:
Code: Select all
/ip ipsec active-peers> print
Flags: R - responder, N - natt-peer
# ID STATE UPTIME PH2-TOTAL REMOTE-ADDRESS DYNAMIC-ADDRESS
As an alternative, is there also a way to pull out the "Flags" value because there's another place where I can grab this address and - if I can check the flags - I can know whether or not the VPN is active. There's an X as a Flag when it's not enabled. How do I put that into a variable in a script?
Code: Select all
/ip ipsec peer> print
Flags: X - disabled, D - dynamic, R - responder
0 X name="Proton VPN server" address=x.x.x.x/32 profile=Proton VPN profile exchange-mode=ike2 send-initial-contact=yes
Any info would be appreciated