Use Remote Host IP of OVPN interface as a variable in a bash script.
-
How would I go about setting a variable in a bash script to the remote host of ovpnc1?
-
Need more info, guess take a look at Environmental Variables on:
https://community.openvpn.net/openvpn/wiki/Openvpn24ManPage -
The closest thing I can find there is --show-gateway, which lists the IP of the gateway interface that OpenVPN uses to make its connections. I don't see any commands that give me the remote host information shown on status_openvpn.php in webconfigurator.
edit: Success! I accomplished what I wanted by using the following:
INTERFACEIP=`dig @resolver1.opendns.com ovpnc1 myip.opendns.com +short`
Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.