#!/bin/bash MYIP=AAA.BBB.CCC.DDD VPI=8 VCI=36 MYGATEWAY=`echo $MYIP | sed -e 's/[0-9]\+$/254/'` ps -e | grep atmarpd > /dev/null stat_daemon=$? ifconfig -a | grep atm0 > /dev/null stat_interface=$? ifconfig | grep atm0 > /dev/null interface_up=$? case "$1" in start) if [ $stat_daemon -ne 0 ] ; then atmarpd -b 2> /dev/null sleep 2 fi if [ $stat_interface -eq 0 ] ; then ifconfig atm0 up else atmarp -c atm0 ifconfig atm0 $MYIP netmask 255.255.255.0 mtu 1500 up fi atmarp -s $MYGATEWAY $VPI.$VCI null 2> /dev/null route del default 2> /dev/null route add default gw $MYGATEWAY echo -e "\nconnecté\n" exit 0 ;; stop) if [ $interface_up -eq 0 ] ; then if [ $stat_daemon -eq 0 ] ; then atmarp -d $MYGATEWAY ; fi route del default 2> /dev/null ifconfig atm0 down fi echo -e "\ndéconnecté\n" exit 0 ;; *) echo -e "\nUsage: sudo freedeg [start|stop]\n" exit 1 ;; esac