summaryrefslogtreecommitdiff
path: root/roles/install_wireguard_mesh/templates/up.sh.j2
blob: 8164f2af075819adf80977a8656bef5d0b2c0732 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/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 %}
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
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 %}