#!/bin/sh PATH=/sbin:/usr/sbin:/bin:/usr/bin cd /etc/sysconfig/network-scripts . network-functions IP=/sbin/ip CONFIG=$1 [ -f "$CONFIG" ] || CONFIG="ifcfg-$1" source_config if [ -z "$TUNLOCAL" ]; then echo "missing TUNLOCAL"; exit 1 fi if [ -z "$TUNREMOTE" ]; then echo "missing TUNREMOTE"; exit 1 fi if [ -z "$PHYSLOCAL" ]; then echo "missing PHYSLOCAL"; exit 1 fi if [ -z "$PHYSREMOTE" ]; then echo "missing PHYSREMOTE"; exit 1 fi if [ -z "$TTL" ]; then TTL="inherit" fi if [ -z "$TYPE" ]; then TYPE="ipip" fi if [ -z "$REMOTENETMASKLEN" ]; then REMOTENETMASKLEN=32 fi if [ "$2" = "boot" -a "$ONBOOT" = "no" ]; then exit fi [ -x "$IP" ] || { echo "$IP does not exist or is not executable" echo "ifup-tun for $DEVICE exiting" logger -p daemon.info -t ifup-tun \ "$IP does not exist or is not executable for $DEVICE" exit 1 } $IP tunnel add $DEVICE mode $TYPE local $PHYSLOCAL remote $PHYSREMOTE ttl $TTL $IP address add $TUNLOCAL peer $TUNREMOTE/$REMOTENETMASKLEN dev $DEVICE $IP link set dev $DEVICE up