add mtu handling

This commit is contained in:
nd 2021-01-25 11:58:13 +01:00
parent 3f3ed2fe15
commit 51fde95c0e
No known key found for this signature in database
GPG key ID: 21B5CD4DEE3670E9
2 changed files with 2 additions and 0 deletions

View file

@ -7,5 +7,6 @@ wireguard:
route: [] route: []
route6: [] route6: []
peers: {} peers: {}
mtu: 1420
connections: {} connections: {}

View file

@ -3,6 +3,7 @@ iface wg_{{ item.name }} inet manual
post-down ip link del $IFACE post-down ip link del $IFACE
pre-up ip link add $IFACE type wireguard || true pre-up ip link add $IFACE type wireguard || true
pre-up wg setconf $IFACE /etc/wireguard/$IFACE.conf pre-up wg setconf $IFACE /etc/wireguard/$IFACE.conf
up ip link set dev $IFACE mtu {{ item.mtu }}
{% if item.route|length == 1 and item.ip|length == 1%} {% if item.route|length == 1 and item.ip|length == 1%}
pre-up ip a add {{ item.ip[0] }} peer {{ item.route[0] }} dev $IFACE pre-up ip a add {{ item.ip[0] }} peer {{ item.route[0] }} dev $IFACE
up ip route replace {{ item.route[0] }} src {{ item.ip[0].split('/')[0] }} dev $IFACE up ip route replace {{ item.route[0] }} src {{ item.ip[0].split('/')[0] }} dev $IFACE