Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Use Remote Host IP of OVPN interface as a variable in a bash script.

    Scheduled Pinned Locked Moved OpenVPN
    3 Posts 2 Posters 296 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      SeaMonkey
      last edited by

      How would I go about setting a variable in a bash script to the remote host of ovpnc1?

      1 Reply Last reply Reply Quote 0
      • PippinP
        Pippin
        last edited by

        Need more info, guess take a look at Environmental Variables on:
        https://community.openvpn.net/openvpn/wiki/Openvpn24ManPage

        I gloomily came to the ironic conclusion that if you take a highly intelligent person and give them the best possible, elite education, then you will most likely wind up with an academic who is completely impervious to reality.
        Halton Arp

        1 Reply Last reply Reply Quote 0
        • S
          SeaMonkey
          last edited by SeaMonkey

          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`
          
          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.