]> git.immae.eu Git - perso/Immae/Config/tinc/hosts.git/blobdiff - ImmaeEu-up
Android
[perso/Immae/Config/tinc/hosts.git] / ImmaeEu-up
index 95004f34bcf053d87527470e2b7ec07f5a9a0532..f57c2e37c9300ea34f4a6261e7906818deb422f8 100644 (file)
@@ -10,4 +10,9 @@ ip -6 link set vpn6 up mtu 1280
 for MYIP in $MYIPS; do
        ip -6 addr add $MYIP/96 dev vpn6
 done
-ip -6 route add default via $GWIP
+ORIGINAL_GATEWAY=$(for a in $(ip rule show | grep lookup | sed -r 's/.* lookup ([^ ]+).*/\1/'); do ip route show table $a | grep ^default | cut -d ' ' -f 2-5; done | head -1)
+
+ip -6 rule add prio 100 from all lookup 100
+ip route add table 100 $REMOTEADDRESS $ORIGINAL_GATEWAY 
+ip -6 route add table 100 $GWIP dev vpn6
+ip -6 route add table 100 ::/1 via $GWIP dev vpn6