summaryrefslogtreecommitdiff
path: root/roles/setup_batman
diff options
context:
space:
mode:
Diffstat (limited to 'roles/setup_batman')
-rwxr-xr-xroles/setup_batman/files/ffmyk-iproute.sh20
-rw-r--r--roles/setup_batman/files/modules-load.d_batman.conf1
-rw-r--r--roles/setup_batman/tasks/main.yml26
-rw-r--r--roles/setup_batman/templates/netctl_bat0.j27
4 files changed, 54 insertions, 0 deletions
diff --git a/roles/setup_batman/files/ffmyk-iproute.sh b/roles/setup_batman/files/ffmyk-iproute.sh
new file mode 100755
index 0000000..49fbb16
--- /dev/null
+++ b/roles/setup_batman/files/ffmyk-iproute.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+#Routingtabelle ffmyk ist per default nicht erreichbar
+ip route add unreachable default table ffmyk
+
+#Alles, was mit 0x1 markiert wird gehört zu Tabelle ffmyk
+ip rule add from all fwmark 0x1 table ffmyk
+
+#Alles mit Freifunk-IP - woher auch immer - gehlrt zu Tabelle ffmyk
+ip rule add from 10.222.0.0/16 table ffmyk
+
+#Tabelle ffmyk routet das Ziel mit Freifunk-IPs über das Device bat0
+ip route replace 10.222.0.0/16 dev bat0 table ffmyk
+
+ip route replace 0.0.0.0/1 via 10.222.100.1 dev bat0 metric 666 table ffmyk # fastd1
+ip route replace 128.0.0.0/1 via 10.222.100.1 dev bat0 metric 666 table ffmyk # fastd1
+ip route replace 0.0.0.0/1 via 10.222.112.1 dev bat0 metric 667 table ffmyk # fastd2
+ip route replace 128.0.0.0/1 via 10.222.112.1 dev bat0 metric 667 table ffmyk # fastd2
+ip route replace 0.0.0.0/1 via 10.222.120.1 dev bat0 metric 668 table ffmyk # fastd3
+ip route replace 128.0.0.0/1 via 10.222.120.1 dev bat0 metric 668 table ffmyk # fastd3
+
diff --git a/roles/setup_batman/files/modules-load.d_batman.conf b/roles/setup_batman/files/modules-load.d_batman.conf
new file mode 100644
index 0000000..116b850
--- /dev/null
+++ b/roles/setup_batman/files/modules-load.d_batman.conf
@@ -0,0 +1 @@
+batman-adv
diff --git a/roles/setup_batman/tasks/main.yml b/roles/setup_batman/tasks/main.yml
new file mode 100644
index 0000000..c3e8372
--- /dev/null
+++ b/roles/setup_batman/tasks/main.yml
@@ -0,0 +1,26 @@
+---
+- name: load batman-adv kernel module at boot
+ copy:
+ src: modules-load.d_batman.conf
+ dest: /etc/modules-load.d/batman.conf
+
+- name: install batctl
+ pacman:
+ name: batctl
+ state: present
+
+- name: name ffmyk routing table
+ lineinfile:
+ path: /etc/iproute2/rt_tables
+ line: 42 ffmyk
+
+- name: copy ffmyk iproute config script
+ copy:
+ src: ffmyk-iproute.sh
+ dest: /usr/local/bin/ffmyk-iproute.sh
+ mode: 0744
+
+- name: add netctl config
+ template:
+ src: netctl_bat0.j2
+ dest: /etc/netctl/bat0
diff --git a/roles/setup_batman/templates/netctl_bat0.j2 b/roles/setup_batman/templates/netctl_bat0.j2
new file mode 100644
index 0000000..e48c5b8
--- /dev/null
+++ b/roles/setup_batman/templates/netctl_bat0.j2
@@ -0,0 +1,7 @@
+Connection=ethernet
+Interface=bat0
+IP=static
+IP6=static
+Address6=({{ bat0_ipv6 }}/64)
+Address=({{ bat0_ipv4 }}/16)
+ExecUpPost=/usr/local/bin/ffmyk-iproute.sh