summaryrefslogtreecommitdiff
path: root/data/templates/openvpn/server.conf.j2
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2023-09-14 15:37:20 +0100
committerGitHub <noreply@github.com>2023-09-14 15:37:20 +0100
commit599016be1ac0b659a4baf696d5be7db9a36a2fea (patch)
tree74a0d7eef971b717271519d8c4e2a3ba08d5ef99 /data/templates/openvpn/server.conf.j2
parentc355b07c21b6cac7405a6e575947a181fd2236f5 (diff)
parent0ccbbca01b22232b5cba63d64ab00eb54af7b068 (diff)
downloadvyos-1x-599016be1ac0b659a4baf696d5be7db9a36a2fea.tar.gz
vyos-1x-599016be1ac0b659a4baf696d5be7db9a36a2fea.zip
Merge pull request #1637 from ordex/T3214
openvpn: T3214: fix server-ipv6 and nopool handling
Diffstat (limited to 'data/templates/openvpn/server.conf.j2')
-rw-r--r--data/templates/openvpn/server.conf.j211
1 files changed, 1 insertions, 10 deletions
diff --git a/data/templates/openvpn/server.conf.j2 b/data/templates/openvpn/server.conf.j2
index f76fbbe79..2eb9416fe 100644
--- a/data/templates/openvpn/server.conf.j2
+++ b/data/templates/openvpn/server.conf.j2
@@ -74,7 +74,7 @@ topology {{ server.topology }}
{% endif %}
{% for subnet in server.subnet %}
{% if subnet | is_ipv4 %}
-server {{ subnet | address_from_cidr }} {{ subnet | netmask_from_cidr }} nopool
+server {{ subnet | address_from_cidr }} {{ subnet | netmask_from_cidr }} {{ 'nopool' if server.client_ip_pool is vyos_defined and server.client_ip_pool.disable is not vyos_defined else '' }}
{# First ip address is used as gateway. It's allows to use metrics #}
{% if server.push_route is vyos_defined %}
{% for route, route_config in server.push_route.items() %}
@@ -85,15 +85,6 @@ push "route-ipv6 {{ route }}"
{% endif %}
{% endfor %}
{% endif %}
-{# OpenVPN assigns the first IP address to its local interface so the pool used #}
-{# in net30 topology - where each client receives a /30 must start from the second subnet #}
-{% if server.topology is vyos_defined('net30') %}
-ifconfig-pool {{ subnet | inc_ip('4') }} {{ subnet | last_host_address | dec_ip('1') }} {{ subnet | netmask_from_cidr if device_type == 'tap' else '' }}
-{% else %}
-{# OpenVPN assigns the first IP address to its local interface so the pool must #}
-{# start from the second address and end on the last address #}
-ifconfig-pool {{ subnet | first_host_address | inc_ip('1') }} {{ subnet | last_host_address | dec_ip('1') }} {{ subnet | netmask_from_cidr if device_type == 'tun' else '' }}
-{% endif %}
{% elif subnet | is_ipv6 %}
server-ipv6 {{ subnet }}
{% endif %}