Skip to content

Commit 10c63b6

Browse files
committed
routes for ipv6
1 parent 97861d4 commit 10c63b6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

templates/etc/wireguard/inc/routing.conf.j2

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
{% for net in wg_peer.AllowedIPs | ensure_list %}
33
{% for gw in wg_peer.Address | ensure_list %}
44
{% if gw.split('/')[0] != net.split('/')[0] %}
5-
{% if (gw | ansible.utils.ipv4 and net | ansible.utils.ipv4) or (gw | ansible.utils.ipv6 and net | ansible.utils.ipv6) %}
5+
{% if gw | ansible.utils.ipv4 and net | ansible.utils.ipv4 %}
66
PostUp = ip route add {{ net }} dev %i metric {{ WG_HC.default_routing_metric + loop.index }} via {{ gw.split('/')[0] }}
7+
{% elif gw | ansible.utils.ipv6 and net | ansible.utils.ipv6 %}
8+
PostUp = ip -6 route add {{ net }} dev %i metric {{ WG_HC.default_routing_metric + loop.index }} via {{ gw.split('/')[0] }}
79
{% endif %}
810
{% endif %}
911
{% endfor %}

0 commit comments

Comments
 (0)