#!/bin/sh # # atm.init # # Bring up/down Classical IP over ATM using SVCs and signalling # # Notes: # You must be superuser to execute this script. # Run this script first on the host that is the arp server, then the others. # In our case, atm is the arp server. # mtu is set to 2000 # Edit for your configuration #NET_IPADDR="130.127.201.0" #IPADDR_ATM="130.127.201.24" #IPADDR_CHA="130.127.201.25" #IPADDR_ARP="130.127.201.3" NET_IPADDR="130.127.201.0" #IPADDR_ATM="192.168.1.2" IPADDR_ATM="130.127.201.24" IPADDR_CHA="192.168.1.3" IPADDR_ARP="130.127.201.3" ATMADDR_ARP="47.02.03.04.05.06.07.08.09.00.00.01.01.11.11.11.11.11.11.11" ATMADDR_CHA="47.0203.04050607080900000104.0004AC6C8AD6.00" ATMADDR_ATM="47.0203.04050607080900000104.0004AC6C28F1.00" #LOGPATH="/var/adm/atm" LOGPATH="." MTU=2000 if [ "$#" -lt 1 ] then echo "Usage: atm.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: atm.init [-d]" echo "Use -d option to turn on debugging logs" exit 2 fi else debug="false" fi case "$1" in start) echo "Starting signalization daemon" if [ $debug = "true" ] then if [ -f $LOGPATH/logsig ] then /bin/mv $LOGPATH/logsig $LOGPATH/logsig.old fi /usr/local/sbin/atmsigd -b -d -l $LOGPATH/logsig else /usr/local/sbin/atmsigd -b fi sleep 2 echo "Starting ilmi daemon" if [ $debug = "true" ] then if [ -f $LOGPATH/logilmi ] then /bin/mv $LOGPATH/logilmi $LOGPATH/logilmi.old fi /usr/local/sbin/ilmid -b -d -v -l $LOGPATH/logilmi else /usr/local/sbin/ilmid -b fi sleep 2 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 -m -n else /usr/local/sbin/atmarpd -b fi sleep 3 echo "Creating atm interfaces" /usr/local/sbin/atmarp -c atm0 if [ "`hostname -s`" = "atm" ] then echo "Configuring atm interface" /sbin/ifconfig atm0 $IPADDR_ATM up mtu $MTU netmask 255.255.255.0 echo "Adding routes" /sbin/route add -net $NET_IPADDR netmask 255.255.255.128 dev atm0 # /sbin/route add -net 130.127.28.0 gw 130.127.201.3 netmask 255.255.255.0 dev atm0 # /sbin/route add -net 130.127.4.0 gw 130.127.201.3 netmask 255.255.255.0 dev atm0 echo "Create an ATMARP server entry" /usr/local/sbin/atmarp -s $IPADDR_ARP $ATMADDR_ARP arpsrv else # host is chattooga echo "Configuring atm interface" /sbin/ifconfig atm0 $IPADDR_CHA mtu $MTU netmask 255.255.255.0 echo "Adding routes" /sbin/route add -net $NET_IPADDR netmask 255.255.255.128 dev atm0 /sbin/route add -net 130.127.28.0 gw 130.127.201.3 netmask 255.255.255.0 dev atm0 /sbin/route add -net 130.127.4.0 gw 130.127.201.3 netmask 255.255.255.0 dev atm0 echo "Create an ATMARP server entry" /usr/local/sbin/atmarp -s $IPADDR_ARP $ATMADDR_ARP arpsrv fi # The following line was recommended but does not seem to make a difference /usr/local/sbin/atmarp -q $NET_IPADDR ubr:sdu=$MTU ;; stop) echo "Shutting down interfaces" for Itf in `/sbin/ifconfig | grep atm | awk '{print $1}'` do /sbin/ifconfig $Itf down done # Stopping atmarp daemon atid=`ps -ax | grep /usr/local/sbin/atmarpd | grep -v grep | awk '{print $1}'` echo "Checking for atmarpd..." if [ "$atid" ] then echo "Stopping atmarpd..." kill -9 $atid echo "done" fi # Stopping signalisation daemon sigid=`ps -ax | grep /usr/local/sbin/atmsigd | grep -v grep | awk '{print $1}'` echo "Checking for atmsigd..." if [ "$sigid" ] then echo "Stopping atmsigd..." kill -9 $sigid echo "done" fi # Stopping ilmi daemon ilid=`ps -ax | grep /usr/local/sbin/ilmid | grep -v grep | awk '{print $1}'` echo "Checking for ilmid..." if [ "$ilid" ] then echo "Stopping ilmid..." kill -9 $ilid echo "done" fi ;; *) echo "Usage: atm.init { start | stop } [-d]" ;; esac