OpenVPN MQTT API Reference

The OpenVPN feature is controlled via MQTT tags that are published when the RediGate initially connects to a broker. This document explains the OpenVPN MQTT tags and how to use them.

Assuming that your RediGate has the following parameters:

  • System → Unit Name ($GATEWAY): RG120e-VPN
  • Clients → MQTT Client → JSON RBE → Topic Rules → Device Subscription → Topic String:  RG/${GATEWAY}/${CHAN}_${DEV}/CMD

 

This document assumes that the the OpenVPN configuration was copied/pasted from the demo configuration (available here) into the RediGate configuration.

It assumes that the VPN logic resides in Channel 14 (named Ch14-VPN):

And the MQTT tags for configuration and control reside in RTU 3 (named VPN-RTU):

 

Using the above assumptions, all of the commands below are published on the "RG/RG120e-VPN/Ch14-VPN_VPN-RTU/CMD" topic:

  1. VPN.Start (R/W, Bool)
    1. Description: Starts the connection to the VPN server
    2. Message: {"d": {"VPN.Start": 1}}
  2. VPN.Stop (R/W, Bool)
    1. Description: Stops the connection to the VPN server
    2. Message: {"d": {"VPN.Stop": 1}}
  3. NAT.Restart (R/W, Bool)
    1. Description: Sends the latest NAT settings (NAT.IP_Port, NAT.PLC_IP) and refreshes current values
    2. Message: {"d": {"NAT.Restart": 1}}
  4. NAT.IP_Port (R/W, Int)
    1. Description: Port for which all traffic will forwarded to. For a list of common ports used for industrial communications protocols, see: Port Forwarding for Common PLC's
    2. Message: {"d": {"NAT.IP_Port": 44818}}
  5. NAT.PLC_IP (R/W, String)
    1. Description: IP address of the end device to which all IP traffic over the NAT.IP_Port will be forwarded
    2. Message: {"d": {"NAT.PLC_IP": "192.168.1.110"}}
  6. NAT.TUN0_IP (R, String)
    1. Description: IP address assigned by the VPN tunnel 
    2. Message: READ-ONLY
  7. VPN.ConfName (R, String)
    1. Description: Name of the uploaded configuration file to look for in the home/director or home/Dirupld folders. All VPN configurations uploaded to the RediGate should be named OpenVPN_CONF.txt, or whatever value is set in the "PreInit Values" section of your VPN configuration:
    2. Message: READ-ONLY – values written to this tag will be overwritten on boot-up by the "PreInit Values" configuration on the RediGate
  8. Nat.Eth1_IP (R, String)
    1. Description: IP address of the Eth1 port on the RediGate
    2. Message: READ-ONLY
  9. VPN.AuthName
    1. Description: Username credential for connecting to VPN server
    2. Message: {"d": {"VPN.AuthName": "Your_Username"}}
  10. VPN.AuthPass
    1. Description: Username credential for connecting to VPN server
    2. Message: {"d": {"VPN.AuthPass": "Your_Password"}}