#!/bin/sh # # clip.init # # Bring up/down Classical IP over ATM using PVCs. # Notes: # You must be superuser to execute this script # The signalling demon and ilmi demon are not turned on. # Edit for your configuration IPADDR_ATM="192.168.1.2" IPADDR_CHAT="192.168.1.1" NET_IPADDR="192.168.1.0" PVC="0.0.32" MTU=2000 #LOGPATH="/var/log/atm" LOGPATH="/h10/var/log/atm" if [ "$#" -lt 1 ] then echo "Usage: clip.init [-d]" exit 1 fi if [ "$#" -eq 2 ] then if [ "$2" = "-d" -o "$2" = "d" ] then debug="true" else echo "Unrecognized option: $2" echo "Usage: clip.init [-d]" echo "Use -d option to turn on debugging log" exit 2 fi else debug="false" fi case "$1" in start) echo "starting atmarp daemon" if [ $debug = "true" ] then if [ -f $LOGPATH/logarp ] then /bin/mv $LOGPATH/logarp $LOGPATH/logarp.old fi /usr/local/sbin/atmarpd -b -d -l $LOGPATH/logarp else /usr/local/sbin/atmarpd -b fi sleep 2 echo "creating interface" /usr/local/sbin/atmarp -c atm0 if [ "`hostname -s`" = "atm" ] then echo "configuring interface" /sbin/ifconfig atm0 $IPADDR_ATM up mtu $MTU echo "adding route to routing table" /sbin/route add -net $NET_IPADDR netmask 255.255.255.0 dev atm0 echo "setting up the pvc" if [ $debug = "true" ] then if [ -f $LOGPATH/logclip ] then /bin/mv $LOGPATH/logclip $LOGPATH/logclip.old fi /usr/local/sbin/atmarp -s $IPADDR_CHAT $PVC > $LOGPATH/logclip 2>&1 else /usr/local/sbin/atmarp -s $IPADDR_CHAT $PVC fi else # host is chattooga echo "configuring interface" /sbin/ifconfig atm0 $IPADDR_CHAT up mtu $MTU echo "adding route to routing table" /sbin/route add -net $NET_IPADDR netmask 255.255.255.0 dev atm0 echo "setting up the pvc" if [ $debug = "true" ] then if [ -f $LOGPATH/logclip ] then /bin/mv $LOGPATH/logclip $LOGPATH/logclip.old fi /usr/local/sbin/atmarp -s $IPADDR_ATM $PVC >> startip.log 2>&1 else /usr/local/sbin/atmarp -s $IPADDR_ATM $PVC fi fi ;; stop) # Shutting down interface echo "Shutting down interface" /sbin/ifconfig "atm0" down # Stopping atmarp daemon pid=`ps -ax | grep /usr/local/sbin/atmarpd | grep -v grep | awk '{print $1}'` echo "Checking for atmarpd..." if [ "$pid" ] then echo "Stopping atmarpd" kill -9 $pid echo "done" fi ;; *) echo "Usage: clip.init [-d]" ;; esac