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

    OpenVPN client gateway not visible in config.xml

    Scheduled Pinned Locked Moved General pfSense Questions
    4 Posts 2 Posters 286 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.
    • L
      lajblt
      last edited by

      Hello everobody,

      I am testing a script, which modify static routes. If the primary gateway is down/marked down, route routine is executed and changes some static routing thru the backup gateway. In pfSense 2.3.5 the script can read the gateway status and set the correct routes for all gateways, even for virtual OpenVPN interfaces (TUN1, TUN2 and so on). But in 2.4.4 only gateways on physical interfaces are listed in config.xml. Where can I found these "virtual gateways" and parse the actual status to the php script?

      Thank you very much.

      1 Reply Last reply Reply Quote 0
      • jimpJ
        jimp Rebel Alliance Developer Netgate
        last edited by

        Dynamic gateways won't have an entry in config.xml unless you edit them and change a value, then save.

        There are functions that build the gateway list in various ways, look in /etc/inc/gwlb.inc.

        Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

        Need help fast? Netgate Global Support!

        Do not Chat/PM for help!

        1 Reply Last reply Reply Quote 0
        • L
          lajblt
          last edited by

          2 jimp: Thank you very much for your help. I wrote some test script for pfSsh.php. As I am newbie in PHP, my code can look a little bit funny :), but it seems to be functional. When primary gateway goes down, the script change selected static routes to the second one. When primary gateway is online again, routes are set via this gateway. When both gateways are down and at least one goes online on the next run, script sets the correct routing paths again.

          gateways_check_route_set.txt

          1 Reply Last reply Reply Quote 0
          • L
            lajblt
            last edited by

            Second version of the monitoring script. Now all static routes from config.xml are pushed to an array for main gateway, no script editing is needed except you have to set correct main and backup gateway names before the first run.

            gateway_monitor_v2.txt

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.