diff --git a/src/etc/inc/plugins.inc.d/openvpn.inc b/src/etc/inc/plugins.inc.d/openvpn.inc
index c48d0e4e5..3c4025307 100644
--- a/src/etc/inc/plugins.inc.d/openvpn.inc
+++ b/src/etc/inc/plugins.inc.d/openvpn.inc
@@ -414,6 +414,10 @@ function openvpn_add_dhcpopts(&$settings, &$conf)
}
}
+ if (!empty($settings['route_gateway'])) {
+ $conf .= "push \"route-gateway {$settings['route_gateway']}\"\n";
+ }
+
if (!empty($settings['redirect_gateway'])) {
$redirgw = str_replace(',', ' ', $settings['redirect_gateway']);
$conf .= "push \"redirect-gateway {$redirgw}\"\n";
diff --git a/src/opnsense/mvc/app/controllers/OPNsense/OpenVPN/forms/dialogCSO.xml b/src/opnsense/mvc/app/controllers/OPNsense/OpenVPN/forms/dialogCSO.xml
index c99764095..4de37547b 100644
--- a/src/opnsense/mvc/app/controllers/OPNsense/OpenVPN/forms/dialogCSO.xml
+++ b/src/opnsense/mvc/app/controllers/OPNsense/OpenVPN/forms/dialogCSO.xml
@@ -79,6 +79,17 @@
trueRemote networks for the server, these are configured via iroute{-ipv6} clauses in OpenVPN and inform the server to send these networks to this specific client.
+
+ cso.route_gateway
+
+ text
+ true
+
+ Specify a default gateway to use for the connected client.
+ Without one set the first address in the netblock is being offered. When segmenting the tunnel (server) network,
+ this one might not be accessible from the client.
+
+ cso.redirect_gateway
diff --git a/src/opnsense/mvc/app/models/OPNsense/OpenVPN/OpenVPN.php b/src/opnsense/mvc/app/models/OPNsense/OpenVPN/OpenVPN.php
index 4570abf1b..cff2ceeec 100644
--- a/src/opnsense/mvc/app/models/OPNsense/OpenVPN/OpenVPN.php
+++ b/src/opnsense/mvc/app/models/OPNsense/OpenVPN/OpenVPN.php
@@ -145,6 +145,7 @@ class OpenVPN extends BaseModel
'dns_domain_search',
'tunnel_network',
'tunnel_networkv6',
+ 'route_gateway',
];
foreach ($opts as $fieldname) {
$result[$fieldname] = (string)$cso->$fieldname;
diff --git a/src/opnsense/mvc/app/models/OPNsense/OpenVPN/OpenVPN.xml b/src/opnsense/mvc/app/models/OPNsense/OpenVPN/OpenVPN.xml
index 6c2428e57..62f416340 100644
--- a/src/opnsense/mvc/app/models/OPNsense/OpenVPN/OpenVPN.xml
+++ b/src/opnsense/mvc/app/models/OPNsense/OpenVPN/OpenVPN.xml
@@ -44,6 +44,10 @@
NY
+
+ N
+ N
+ NY