Possible to get VPN client IP within a script?

Hello, all I want is similar output to following command:

:put [get [/ip address find interface=ether1-gateway ] address]
192.168.87.252

except I want to get it for my client VPN IP (using an SSTP-client interface to another RB) to send an email of which VPN link is being used. I tried:

:put [get [/ip address find interface=sstp-chr ] address]

but that returns NULL. I tried also getting the local-address, but that errors. I can see the address with /ip address print and in /interface sstp-client monitor, but can’t seem to get script syntax to return any IP values from these commands. I see what I want in interactive CLI, but I’m stuck ;-(

Anyone out there know how to get a client VPN IP (local address) for use in script?

Hi,

it’s very simple, you can try these examples:

→ Local IP

:log info [/ip address get [/ip address find interface=<vpn interface>] address]

→ Remote IP

:log info [/ip address get [/ip address find interface=<vpn interface>] network]

→ Caller ID or Client IP Address

:log info [/ppp active get [/ppp active find address=[/ip address get [/ip address find interface=<vpn interface>] network]] caller-id]

you can find everything you need in the documentation.