Docker Container running a Freifunk Gateway. It contains the following components
The image can be pulled from dockerhub:
docker pull klausdieter371/wg-docker
Babeld is built from the 1.9 branch such that it is compatible with the openwrt package feed. This allows source-specific routes being transported properly.
The build can make use of an apt cache.
docker build . \
--tag wireguard:latest \
--build-arg APT_PROXY_PORT=3142 \
--build-arg HOST_IP=192.168.13.9
Will start a build relying on a cache on 192.168.13.9 that is reachable on port 3142
The image will require some variables and parameters to be set in order to run:
It is designed to be run like this when in interactive mode:
modprobe ip6_tables
modprobe wireguard
docker run -a stdin -a stdout -a stderr -it --rm --name wg \
--network host \
--cap-add=NET_ADMIN \
--device /dev/net/tun:/dev/net/tun \
--env-file ./env-file \
--privileged \
--sysctl net.ipv6.conf.all.forwarding=1 \
--sysctl net.ipv6.conf.all.accept_redirects=0 \
--sysctl net.ipv4.conf.all.rp_filter=0 klausdieter371/wg-docker
The required settings are:
babeld will distribute all routes that are added to routing tables 11 and 12 and it will export all routes to table 10. L3roamd from within the container will fill table 11 If you want to distribute a default route in the network, run something like
Ip -6 r a fe80::1 dev eth0 proto bird table 12
on the docker host.
When running with strace, the following capabilities should be added:
--cap-add sys_admin --cap-add sys_ptrace
When running the container a bit of environment setup must happen:
#!/bin/bash
ip -6 r d default
ip -6 r a default via fe80::1 dev eth0 src 2a01:4f8:1c1c:71b5::1
# lookup clat prefix in freifunk routing table
ip -6 ru a to fdff:ffff:ffff::/48 lookup 10
ip -6 ru a to fdff:ffff:fffe::/48 lookup 10
# reach the rest of the batman network
ip -6 r a fda9:26e:5805::/64 dev backend-gw2 proto static
ip -6 a a fda9:26e:5805:bab1:aaaa::1/64 dev eth0
ip -6 r a fda9:26e:5805::2 dev backend-gw2 proto static t 12
ip -6 r a fda9:26e:5805::2 dev backend-gw2 proto static t 10
ip -6 r a 2000::/3 from fda9:26e:5805::/48 dev backend-gw2 proto static t 10
ip -6 r a 2000::/3 from fda9:26e:5805::/48 dev backend-gw2 proto static t 12
ip -6 r a fda9:26e:5805::/48 dev backend-gw2 proto static t 10
ip -6 r a fda9:26e:5805::/48 dev backend-gw2 proto static t 12
meshifs="babel-wg-+ backend-bab+"
for i in $meshifs
do
ip6tables -I INPUT 1 -i $i -s fe80::/64 -p udp -m udp --dport 6696 -j ACCEPT
ip6tables -I INPUT 1 -i $i -s fe80::/64 -p udp -m udp --dport 27275 -j ACCEPT
ip6tables -I INPUT 1 -i $i -s fda9:026e:5805:bab1::/64 -p udp -m udp --dport 6696 -j ACCEPT
ip6tables -I INPUT 1 -i $i -s fda9:026e:5805:bab1::/64 -p udp -m udp --dport 27275 -j ACCEPT
ip6tables -I INPUT 1 -i $i -p udp -m udp --dport 5523 -j ACCEPT
# MSS Clamping
ip6tables -t mangle -A FORWARD -o $i -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
iptables -t mangle -A FORWARD -o $i -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
ip6tables -t mangle -A OUTPUT -o $i -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
iptables -t mangle -A OUTPUT -o $i -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
done
exit 0
Content type
Image
Digest
Size
262.8 MB
Last updated
over 5 years ago
docker pull ffmd/wg