]> git.immae.eu Git - perso/Immae/Config/tinc/hosts.git/blame - ImmaeEu-up
Re-put Jabbah
[perso/Immae/Config/tinc/hosts.git] / ImmaeEu-up
CommitLineData
5618bf79
IB
1#!/bin/sh
2# This file sets up the tap device.
3# It gives you the freedom to do anything you want with it.
4# Use the correct name for the tap device:
5# The environment variable $INTERFACE is set to the right name
6# on most platforms, but if it doesn't work try to set it manually.
7
8# Give it the right ip and netmask. Remember, the subnet of the
9# tap device must be larger than that of the individual Subnets
10# as defined in the host configuration file!
dbf5d283 11SUBDOMAIN=$(echo "$NAME" | sed -e "s/\([A-Z][a-z0-9]*\)/\L\1 /g;" | awk '{ for (i=NF; i>1; i--) printf("%s.",$i); print $1; }')
5618bf79 12while [ -z "$MYIPS" -o -z "$GWIP" ]; do
dbf5d283
IB
13 MYIPS=`getent hosts ${SUBDOMAIN}.immae.eu | cut -d' ' -f1 | tr "\\n" ' '`
14 GWIP=`getent hosts gw.vpn.immae.eu | head -n1 | cut -d' ' -f1`
15 sleep 5
5618bf79 16done
dbf5d283
IB
17rm -f /run/tinc_$NETNAME.vars
18echo -e "MYIPS=\"$MYIPS\"\nGWIP=\"$GWIP\"" > /run/tinc_$NETNAME.vars
5618bf79
IB
19ip -6 link set $INTERFACE up mtu 1280
20for MYIP in $MYIPS; do
f27841e1
IB
21 ip -6 addr add $MYIP/96 dev $INTERFACE
22 ip -6 rule add from $MYIP/96 table 655
23 ip -6 rule add to $MYIP/96 table 655
5618bf79 24done
bd3711f0 25ip -6 route add default via $GWIP dev $INTERFACE table 655
bd13fdc8 26(cd /etc/tinc/$NETNAME/hosts && git pull -q origin master) || true