]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/private/vpn/tinc/tinc-up
Add Tinc VPN
[perso/Immae/Config/Nix.git] / modules / private / vpn / tinc / tinc-up
diff --git a/modules/private/vpn/tinc/tinc-up b/modules/private/vpn/tinc/tinc-up
new file mode 100755 (executable)
index 0000000..26c1ec3
--- /dev/null
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+
+echo 1 > /proc/sys/net/ipv6/conf/@mainInterface@/proxy_ndp
+echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
+
+SUBNET=`getent hosts sn.vpn.immae.eu | head -n1 | cut -d' ' -f1`
+GWIP=`getent hosts gw.vpn.immae.eu | head -n1 | cut -d' ' -f1`
+
+ip -6 link set $INTERFACE up mtu 1280 txqueuelen 1000
+
+ip -6 addr add $GWIP/96 dev $INTERFACE
+ip -6 route add $SUBNET/80 dev $INTERFACE
+
+ip neigh add proxy $GWIP dev @mainInterface@