SLICEID=`id -u $SLICE`
read INDEX
read REMOTE
-read KEY
+
+KEYFILE="/etc/vini/egre-keys.txt"
+if [ -e "$KEYFILE" ]; then
+ KEY=$( awk -v slice=$SLICE '$1 == slice {print $2}' $KEYFILE )
+fi
+if [ -z "$KEY" ]; then
+ echo "No EGRE key found for slice $SLICE!"
+ echo "Please send mail to vini-users@lists.planet-lab.org."
+ exit 1
+fi
LINK=${KEY}if${INDEX}
### Setup EGRE tunnel
EGRE=d$LINK
-$IP tunnel add $EGRE mode gre/eth remote $REMOTE key $KEY
+$IP tunnel add $EGRE mode gre/eth remote $REMOTE key $KEY ttl 64
$IP link set $EGRE up
### Setup etun