#!/bin/sh

# Creation of series of tunnel endpoints on local address 192.168.74.242 with
# local endpoint 10.77.${15+i}.2/30, to remote address 10.0.209.${80+i} with
# remote endpoint 10.77.${15+i}.1
# OS: FreeBSD. Tested on: FreeBSD 8.4 STABLE.

ifconfig=/sbin/ifconfig
GNOS="15 16 17 18 19 20"

for GNO in ${GNOS}; do
	GIF="gif${GNO}"
	$ifconfig ${GIF} destroy > /dev/null 2>&1
	NA=$((${GNO}+65))
	$ifconfig ${GIF} create
	$ifconfig ${GIF} mtu 1500 up
	$ifconfig ${GIF} tunnel 192.168.74.242 10.0.209.${NA}
	$ifconfig ${GIF} 10.77.${GNO}.2/30 10.77.${GNO}.1
done
