fastd working
parent
90a8a597ea
commit
d82f852497
@ -0,0 +1,14 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=sets up ip rules and static routes
|
||||||
|
ConditionPathExists=/usr/local/bin/ffmyk-iproute.sh
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=forking
|
||||||
|
ExecStart=/usr/local/bin/ffmyk-iproute.sh
|
||||||
|
TimeoutSec=0
|
||||||
|
StandardOutput=tty
|
||||||
|
RemainAfterExit=yes
|
||||||
|
SysVStartPriority=99
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#Routingtabelle ffmyk ist per default nicht erreichbar
|
||||||
|
ip -4 route add unreachable default table ffmyk
|
||||||
|
ip -6 route add unreachable default table ffmyk
|
||||||
|
|
||||||
|
#Alles, was mit 0x1 markiert wird gehört zu Tabelle ffmyk
|
||||||
|
ip -4 rule add from all fwmark 0x1 table ffmyk
|
||||||
|
ip -6 rule add from all fwmark 0x1 table ffmyk
|
||||||
|
|
||||||
|
#Alles mit Freifunk-IP - woher auch immer - gehlrt zu Tabelle ffmyk
|
||||||
|
ip -4 rule add from 10.222.0.0/16 table ffmyk
|
||||||
|
ip -6 rule add from 2001:470:cd45:FF00::/56 table ffmyk
|
@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
- 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: copy site specific iproute up config script
|
||||||
|
template:
|
||||||
|
src: ffmyk-iproute-up.j2
|
||||||
|
dest: /usr/local/bin/ffmyk-iproute{{ item.name }}-up.sh
|
||||||
|
mode: 0744
|
||||||
|
with_items: "{{ sites }}"
|
||||||
|
|
||||||
|
- name: copy site specific iproute down config script
|
||||||
|
template:
|
||||||
|
src: ffmyk-iproute-down.j2
|
||||||
|
dest: /usr/local/bin/ffmyk-iproute{{ item.name }}-down.sh
|
||||||
|
mode: 0744
|
||||||
|
with_items: "{{ sites }}"
|
||||||
|
|
||||||
|
- name: copy ffmyk iproute systemd service
|
||||||
|
copy:
|
||||||
|
src: ffmyk-iproute.service
|
||||||
|
dest: /etc/systemd/system/ffmyk-iproute.service
|
||||||
|
mode: 0444
|
||||||
|
|
||||||
|
- name: start and enable ffmyk iproute service
|
||||||
|
systemd:
|
||||||
|
name: ffmyk-iproute.service
|
||||||
|
daemon_reload: yes
|
||||||
|
enabled: yes
|
||||||
|
state: started
|
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
ip -4 route del {{item.net4 }} dev bat{{ item.name }} proto static table ffmyk
|
||||||
|
ip -6 route del {{item.net6 }} dev bat{{ item.name }} proto static table ffmyk
|
||||||
|
|
||||||
|
ip -4 rule del iif bat{{ item.name }} table ffmyk
|
||||||
|
ip -6 rule del iif bat{{ item.name }} table ffmyk
|
||||||
|
ip -4 rule del from {{ item.net4 }} table ffmyk
|
||||||
|
ip -6 rule del from {{ item.net6 }} table ffmyk
|
||||||
|
ip -4 rule del to {{ item.net4 }} table ffmyk
|
||||||
|
ip -6 rule del to {{ item.net6 }} table ffmyk
|
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
ip -4 rule add iif bat{{ item.name }} table ffmyk
|
||||||
|
ip -6 rule add iif bat{{ item.name }} table ffmyk
|
||||||
|
ip -4 rule add from {{ item.net4 }} table ffmyk
|
||||||
|
ip -6 rule add from {{ item.net6 }} table ffmyk
|
||||||
|
ip -4 rule add to {{ item.net4 }} table ffmyk
|
||||||
|
ip -6 rule add to {{ item.net6 }} table ffmyk
|
||||||
|
|
||||||
|
ip -4 route replace {{item.net4 }} dev bat{{ item.name }} proto static table ffmyk
|
||||||
|
ip -6 route replace {{item.net6 }} dev bat{{ item.name }} proto static table ffmyk
|
@ -1,18 +1,16 @@
|
|||||||
log to syslog level info;
|
log to syslog level info;
|
||||||
interface "ffmyk-mesh-vpn";
|
interface "vpn{{ item.name }}";
|
||||||
method "salsa2012+gmac";
|
method "salsa2012+gmac";
|
||||||
method "salsa2012+umac";
|
method "salsa2012+umac";
|
||||||
secure handshakes yes;
|
secure handshakes yes;
|
||||||
bind any:10000;
|
bind any:{{ item.fastd_port1 }};
|
||||||
hide ip addresses yes;
|
hide ip addresses yes;
|
||||||
hide mac addresses yes;
|
hide mac addresses yes;
|
||||||
mtu 1280;
|
mtu 1280;
|
||||||
peer group "clients" {
|
peer group "clients" {
|
||||||
include peers from "peers";
|
include peers from "peers";
|
||||||
peer limit {{ fastd_peer_limit }};
|
|
||||||
}
|
}
|
||||||
include peers from "backbone";
|
secret "{{ item.fastd_secret }}";
|
||||||
secret "{{ fastd_secret }}";
|
on up "/etc/fastd/ff{{ item.name }}/bin/up.sh $INTERFACE";
|
||||||
on up "/etc/fastd/ffmyk/bin/up.sh $INTERFACE";
|
status socket "/run/ff{{ item.name }}1.socket";
|
||||||
status socket "/run/ffmyk.socket";
|
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
ip link set address {{ fastd_mesh_mac }} dev $1
|
ip link set address {{ item.fastd_mesh_mac }} dev $1
|
||||||
ip link set up dev $1
|
ip link set up dev $1
|
||||||
batctl -m bat0 if add $1
|
batctl -m bat{{ item.name }} if add $1
|
||||||
batctl -m bat0 gw server 1000000/1000000
|
batctl -m bat{{ item.name }} gw server 1000000/1000000
|
||||||
batctl -m bat0 it 10000
|
batctl -m bat{{ item.name }} it 10000
|
||||||
batctl -m bat0 mm 1
|
batctl -m bat{{ item.name }} mm 1
|
||||||
echo 128 > /sys/class/net/bat0/mesh/hop_penalty
|
echo 64 > /sys/class/net/bat0/mesh/hop_penalty
|
||||||
netctl start bat0
|
netctl start bat{{ item.name }}
|
||||||
systemctl restart dhcpd4.service
|
systemctl restart dhcpd4.service
|
||||||
systemctl restart named.service
|
systemctl restart named.service
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- name: restart radvd
|
||||||
|
systemd:
|
||||||
|
name: radvd.service
|
||||||
|
state: restarted
|
@ -0,0 +1,17 @@
|
|||||||
|
---
|
||||||
|
- name: install radvd
|
||||||
|
pacman:
|
||||||
|
name: radvd
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: radvd config
|
||||||
|
template:
|
||||||
|
src: radvd.conf.j2
|
||||||
|
dest: /etc/radvd.conf
|
||||||
|
notify: restart radvd
|
||||||
|
|
||||||
|
- name: start and enable radvd
|
||||||
|
systemd:
|
||||||
|
name: radvd.service
|
||||||
|
enabled: yes
|
||||||
|
state: started
|
@ -0,0 +1,26 @@
|
|||||||
|
{% for site in sites %}
|
||||||
|
interface bat{{ site.name }}
|
||||||
|
{
|
||||||
|
AdvSendAdvert on;
|
||||||
|
IgnoreIfMissing on;
|
||||||
|
MinRtrAdvInterval 3;
|
||||||
|
MaxRtrAdvInterval 900;
|
||||||
|
|
||||||
|
AdvDefaultPreference low;
|
||||||
|
AdvHomeAgentFlag off;
|
||||||
|
|
||||||
|
prefix {{ site.net6 }}
|
||||||
|
{
|
||||||
|
AdvOnLink on;
|
||||||
|
AdvAutonomous on;
|
||||||
|
AdvRouterAddr off;
|
||||||
|
};
|
||||||
|
|
||||||
|
RDNSS {{ site.bat_ipv6 }}
|
||||||
|
{
|
||||||
|
AdvRDNSSLifetime 30;
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
{% endfor %}
|
@ -1,20 +0,0 @@
|
|||||||
#!/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
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
|||||||
|
Connection=ethernet
|
||||||
|
Interface=bat{{ item.name }}
|
||||||
|
IP=static
|
||||||
|
IP6=static
|
||||||
|
Address6=({{ item.bat_ipv6 }}/64)
|
||||||
|
Address=({{ item.bat_ipv4 }}/20)
|
||||||
|
ExecUpPost=/usr/local/bin/ffmyk-iproute{{ item.name }}-up.sh
|
||||||
|
ExecDownPre=/usr/local/bin/ffmyk-iproute{{ item.name }}-down.sh
|
@ -1,7 +0,0 @@
|
|||||||
Connection=ethernet
|
|
||||||
Interface=bat0
|
|
||||||
IP=static
|
|
||||||
IP6=static
|
|
||||||
Address6=({{ bat0_ipv6 }}/64)
|
|
||||||
Address=({{ bat0_ipv4 }}/16)
|
|
||||||
ExecUpPost=/usr/local/bin/ffmyk-iproute.sh
|
|
Loading…
Reference in New Issue