Community discussions

 
User avatar
marcperea
Trainer
Trainer
Topic Author
Posts: 11
Joined: Wed Feb 03, 2016 11:01 pm
Location: Minot ND
Contact:

Possible to get VPN client IP within a script?

Fri Oct 14, 2016 7:21 am

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?
Turbocharge your Internet!
http://aerez.net
 
User avatar
antwal
just joined
Posts: 12
Joined: Sun Jul 08, 2012 4:07 pm
Contact:

Re: Possible to get VPN client IP within a script?

Tue Feb 07, 2017 10:44 pm

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.

Who is online

Users browsing this forum: No registered users and 3 guests