Role wireguard: set mtu and link-local address

This commit is contained in:
Julian Labus 2019-03-24 22:22:19 +01:00
parent 13b470b5c9
commit dc1f469265
No known key found for this signature in database
GPG key ID: 8AF209F2C6B3572A

View file

@ -4,6 +4,7 @@
{% for network in my_wireguard_networks %} {% for network in my_wireguard_networks %}
auto wg-{{ network.remote[:11] }} auto wg-{{ network.remote[:11] }}
iface wg-{{ network.remote[:11] }} iface wg-{{ network.remote[:11] }}
mtu 1420
ipv6-addrgen off ipv6-addrgen off
{% if magic < network.remote_magic %} {% if magic < network.remote_magic %}
address {{ network.ipv4 | ipaddr('ip/prefix') }} address {{ network.ipv4 | ipaddr('ip/prefix') }}
@ -12,6 +13,7 @@ iface wg-{{ network.remote[:11] }}
address {{ network.ipv4 | ipaddr('1') | ipaddr('ip/prefix') }} address {{ network.ipv4 | ipaddr('1') | ipaddr('ip/prefix') }}
address {{ network.ipv6 | ipaddr('1') | ipaddr('ip/prefix') }} address {{ network.ipv6 | ipaddr('1') | ipaddr('ip/prefix') }}
{% endif %} {% endif %}
address {{ 'fe80::/64' | ipaddr(magic) | ipaddr('ip/prefix') }}
pre-up ip link add dev $IFACE type wireguard pre-up ip link add dev $IFACE type wireguard
pre-up wg setconf $IFACE /etc/wireguard/$IFACE.conf pre-up wg setconf $IFACE /etc/wireguard/$IFACE.conf
post-up ip link set up dev $IFACE post-up ip link set up dev $IFACE