ansible.fftdf.supernode/roles/21-install-wireguard/files/postup.sh

10 lines
272 B
Bash

#!/bin/sh
ip rule add fwmark 0x4 table 42
iptables -t mangle -A PREROUTING -s 10.255.0.0/16 ! -d 10.0.0.0/8 -j MARK --set-mark 4
routeExists=$(ip route show table 42 | grep '172.16.7.1')
if [ -z "$routeExists" ]; then
ip route add default via 172.16.7.1 table 42
fi