#!/bin/sh
set $(cat /tmp/ipsub_intern.txt | tr "/" " ")
IP_INT=$1
SUB_INT=$2
set $(cat /tmp/ipsub_extern.txt | tr "/" " ")
IP_EXT=$1
SUB_EXT=$2
set $(echo $IP_INT | tr "." " ")
IP_INT_LAST=$4
IP_INT_LAST_P=`expr $4 + 1` IP_PARTNER=$1.$2.$3.$IP_INT_LAST_P
rm -f /etc/ipsec.conf
cp /KNOPPIX/etc/ipsec.conf_VORLAGE /etc/ipsec.conf
if [ $IP_INT_LAST -eq 1 ]; then leftid=pcsec2 rightid=pcsec1
elif [ $IP_INT_LAST -eq 23 ]; then leftid=pcsec4 rightid=pcsec3
elif [ $IP_INT_LAST -eq 45 ]; then leftid=pcsec6 rightid=pcsec5
elif [ $IP_INT_LAST -eq 207 ]; then leftid=pcsec8 rightid=pcsec7
elif [ $IP_INT_LAST -eq 209 ]; then leftid=pcsec10 rightid=pcsec9
fi
echo "conn pcsec$IP_INT_LAST-pcsec$IP_INT_LAST_P" >> /etc/ipsec.conf
echo "leftid=@$leftid" >> /etc/ipsec.conf
echo "left=$IP_PARTNER" >> /etc/ipsec.conf
echo "rightid=@$rightid" >> /etc/ipsec.conf
echo "right=$IP_INT" >> /etc/ipsec.conf