summaryrefslogtreecommitdiff
path: root/roles/install_wireguard_mesh/templates/up.sh.j2
diff options
context:
space:
mode:
Diffstat (limited to 'roles/install_wireguard_mesh/templates/up.sh.j2')
-rw-r--r--roles/install_wireguard_mesh/templates/up.sh.j219
1 files changed, 14 insertions, 5 deletions
diff --git a/roles/install_wireguard_mesh/templates/up.sh.j2 b/roles/install_wireguard_mesh/templates/up.sh.j2
index 1f0c111..8164f2a 100644
--- a/roles/install_wireguard_mesh/templates/up.sh.j2
+++ b/roles/install_wireguard_mesh/templates/up.sh.j2
@@ -1,13 +1,15 @@
#!/bin/bash
+ip -6 link add vx{{ item.name }} type vxlan id {{ item.vxlan_id }} dstport 8472 local {{ item.wireguard_mesh_address }} dev wg{{ item.name }}
+ip link set mtu 1280 dev vx{{ item.name }}
+ip link set address {{ item.wireguard_mesh_mac }} dev vx{{ item.name }}
+ip link set up dev vx{{ item.name }}
+batctl meshif bat{{ item.name }} if add vx{{ item.name }}
{% for host in groups['fastd'] %}
{% for site in hostvars[host]['sites'] if site.name == item.name and site.wireguard_mesh_number != item.wireguard_mesh_number %}
-ip link add mesh{{ item.name }}{{ site.wireguard_mesh_number }} type ip6gretap remote {{ site.wireguard_mesh_address }} local {{ item.wireguard_mesh_address }} ttl 255 dev wg{{ item.name }}
-ip link set mtu 1280 dev mesh{{ item.name }}{{ site.wireguard_mesh_number }}
-ip link set address {{ item.wireguard_mesh_mac_prefix }}{{ site.wireguard_mesh_number }} dev mesh{{ item.name }}{{ site.wireguard_mesh_number }}
-ip link set up dev mesh{{ item.name }}{{ site.wireguard_mesh_number }}
-batctl meshif bat{{ item.name }} if add mesh{{ item.name }}{{ site.wireguard_mesh_number }}
+bridge fdb append 00:00:00:00:00:00 dev vx{{ item.name }} dst {{ site.wireguard_mesh_address }}
{% endfor %}
{% endfor %}
+{% if item.net4 is defined %}
batctl meshif bat{{ item.name }} gw server 1000000/1000000
batctl meshif bat{{ item.name }} it 10000
batctl meshif bat{{ item.name }} mm 1
@@ -15,3 +17,10 @@ batctl meshif bat{{ item.name }} hop_penalty 64
netctl start bat{{ item.name }}
systemctl restart dhcpd4.service
systemctl restart named.service
+{% else %}
+batctl meshif bat{{ item.name }} gw client
+batctl meshif bat{{ item.name }} it 10000
+batctl meshif bat{{ item.name }} mm 1
+batctl meshif bat{{ item.name }} hop_penalty 64
+netctl start bat{{ item.name }}
+{% endif %}