TRB246 - Data to Server - Openvpn IP

Hello,

I would like to send automatically the IP assigned by openVPN client using the Data To Server service.

The “ip” implementation i found returns the WAN IP.

Is there a simple to gather the openVPN and transmit it with a label “ip”.

Greetings, @davidgillot,

Thank you for your message,

It is possible to retrieve OpenVPN client IPs using Lua scripts. You can refer to the official API documentation for guidance on the endpoints:

The specific variable you will need is local_ip. The documentation explains how to access this value through API calls and scripts.

Additionally, could you clarify whether your goal is to collect all VPN client IPs connected to the server, or if each client should report its own IP to the server? This will help determine the best approach.

Looking forward to your reply.

Kind regards,
V.

Thanks Vilius.
We configure the TRB246 using an openVPN config file.
We would like to the local openVPN IP address to be sent as part of a Data-to-Server JSON message that includes other “standard” fields e.g. FW level, Serial, etc.
So far, we could include %ip% from GSM Data type but it provides the WAN IP.
I understand we can retrieve the genuine local openVPN IP using a Lua script. However I am not really familiar with this language. Hence I would appreciate some guidance.

Greetings,

Thank you for your message,

Custom script development is outside the scope of our technical support. However, you can refer to the official documentation for guidance on the API endpoints. In your case, you’ll want to make an API call to retrieve local_ip from the endpoint:

GET /openvpn/{id}/clients/config

When using Lua script as the input type, you can download an example Lua script from the WebUI to get started. For reference, here is the official Lua documentation:

Kind regards,
V.

Thanks - i understand you can’t write a script.
However i need some guidance in building up the element (data input).
In “name” - i will use “my_openvpn"_ip” that will be transported via my data collection json.
Then in type: i understand it will be “Lua script” as i will retrieve the value with it.
Then in format: i would use ‘custom’ with the tag %local_ip% where local_ip is the variable used in the Lua script.
Is it the right way? This is really not clear to me.

Looking forward to your feedback

Greetings,

Thank you for your message,

Yes this is correct, in case you have any additional questions, please let me know!

Kind regards,
V.

This topic was automatically closed after 60 days. New replies are no longer allowed.