Skip to content

Commit

Permalink
routes for ipv6
Browse files Browse the repository at this point in the history
  • Loading branch information
ansibleguy committed Sep 24, 2023
1 parent 97861d4 commit 10c63b6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion templates/etc/wireguard/inc/routing.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
{% for net in wg_peer.AllowedIPs | ensure_list %}
{% for gw in wg_peer.Address | ensure_list %}
{% if gw.split('/')[0] != net.split('/')[0] %}
{% if (gw | ansible.utils.ipv4 and net | ansible.utils.ipv4) or (gw | ansible.utils.ipv6 and net | ansible.utils.ipv6) %}
{% if gw | ansible.utils.ipv4 and net | ansible.utils.ipv4 %}
PostUp = ip route add {{ net }} dev %i metric {{ WG_HC.default_routing_metric + loop.index }} via {{ gw.split('/')[0] }}
{% elif gw | ansible.utils.ipv6 and net | ansible.utils.ipv6 %}
PostUp = ip -6 route add {{ net }} dev %i metric {{ WG_HC.default_routing_metric + loop.index }} via {{ gw.split('/')[0] }}
{% endif %}
{% endif %}
{% endfor %}
Expand Down

0 comments on commit 10c63b6

Please sign in to comment.