Building Linux Virtual Private Networks
(view this code in a separate window)
#!/bin/sh
# ip-up <interface> <myaddr> <daemon-pid> <local> <remote> <arg>
#
# This script is called whenever the CIPE interface comes up/is opened.
# Arguments:
#  $1 interface     the CIPE interface
#  $2 myaddr        our UDP address
#  $3 daemon-pid    the daemon's process ID
#  $4 local         IP address of our CIPE device
#  $5 remote        IP address of the remote CIPE device
#  $6 arg           argument supplied via options
#
# This script can: set up routes, set up proxy arp records,
# start daemons, perform logging.
umask 022
PATH=/sbin:/bin:/usr/sbin:/usr/bin

# add a route to the network passed in the arg (from the options file)
route add -net $6 gw $5 netmask 255.255.255.0

# just a logging example
now=`date "+%b %d %T"`
echo "$now - interface $1 is up. parameters: $*" >> /var/log/cipe.log

Home
Contents
Authors
Reviews
Errata
Colophon
Source Code
Sample Chapter
Suggested Reading
Purchase

New Riders Publishing