OpenVPN client gateway not visible in config.xml

  • 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.

  • Rebel Alliance Developer Netgate

    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/

  • 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.


  • 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.


Log in to reply