[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
ISDN script
Hi all,
I'm enclosing a good (I think) script to connect to any ISP who supports
ISDN in Israel with 2 or 3 modifications to fit into any ISP.
The script allows you to connect at 64k, 128k and disconnect using
simple parameters.
It also features auto-retry dial which some ISP (ahhem) has some
authentications.
Please take a look at both of the file enclosed.
Remarks? notes? flames? I'm here :)
Hetz
--
Linux - The STABLE and FUN way to operate
#!/bin/sh
# Isdn Connect Script v0.2 (11/23/98)
# Written by Andrei Sava (andreisv@isdn.net.il)
# Please contact me about any bugs or suggestions regarding this script.
# Make sure that you are using a recent snapshot of isdn drivers and utils
# downloadable from ftp.suse.com/pub/isdn4linux/
# This script will not work with older isdn4k-utils than v3.0beta1.
# Please fill in the following info:
DIAL=13636 # your isp number
DIALMAX=1 # number of retries to connect to ISP
USER=in??/username # your username
# use inXX/username or inYY/username
# if your ISP is Isdn-Net (isdn.net.il)
HISAX_OPTIONS="type=27 protocol=2" # hisax module options
# "type=27 protocol=2" for fritz!card pci
# Set your password in /etc/ppp/pap-secrets
# Don't forget to copy the supplied 'ioptions' to /etc/ppp/ioptions
case "$1" in
on)
if ! lsmod | grep hisax >/dev/null; then
modprobe hisax $HISAX_OPTIONS
fi
if lsmod | grep hisax >/dev/null; then
if [ `head -n 6 /dev/isdninfo | grep usage | awk '{print $2}'` = 0 ]; then
isdnctrl verbose 3
isdnctrl system on
isdnctrl addif ippp0
isdnctrl addslave ippp0 ippp1
for i in 0 1 ; do
isdnctrl eaz ippp$i $i
isdnctrl addphone ippp$i out $DIAL
isdnctrl huptimeout ippp$i 900
isdnctrl l2_prot ippp$i hdlc
isdnctrl l3_prot ippp$i trans
isdnctrl encap ippp$i syncppp
isdnctrl dialmax ippp$i $DIALMAX
done
ifconfig ippp0 -arp -broadcast
ipppd user $USER file /etc/ppp/ioptions
sleep 2
isdnctrl dial ippp0
if [ "$2" == "2" ]; then
isdnctrl dial ippp1
fi
sleep 10
route add default ippp0
if [ `head -n 6 /dev/isdninfo | grep usage | awk '{print $2}'` = 0 ]; then
echo -e "\aError - Connection not established."
echo "Please check your username, your password, and your provider number."
else
if [ `head -n 6 /dev/isdninfo | grep usage | awk '{print $3}'` = 0 ]; then
echo -e "\aConnected on 1 channel."
else
echo -e "\aConnected on 2 channels."
fi
fi
else
echo -e "\aAlready connected - nothing done."
fi
else
echo -e "\Error - Hisax could not be loaded."
echo "Please make sure that you are using the correct hisax options for your card."
fi
;;
switch)
if [ `head -n 6 /dev/isdninfo | grep usage | awk '{print $2}'` = 0 ]; then
echo -e "\aNot connected. Please use '`basename $0` on' first to connect."
else
case "$2" in
1)
if [ `head -n 6 /dev/isdninfo | grep usage | awk '{print $3}'` != 0 ]; then
isdnctrl hangup ippp1
echo -e "\aChannel 2 disconnected."
else
echo -e "\aChannel 2 is not connected - nothing done."
fi
;;
2)
if [ `head -n 6 /dev/isdninfo | grep usage | awk '{print $3}'` = 0 ]; then
isdnctrl dial ippp1
sleep 8
if [ `head -n 6 /dev/isdninfo | grep usage | awk '{print $3}'` != 0 ]; then
echo -e "\aChannel 2 connected."
else
echo -e "\aError - Could not establish connection on channel 2."
echo "Please make sure that your ISP allows dual-channel connection for your login."
fi
else
echo -e "\aAlready connected on channel 2 - nothing done."
fi
;;
*)
echo -e "\aPlease use '`basename $0` switch 1' or '`basename $0` switch 2'."
;;
esac
fi
;;
off)
if [ `head -n 6 /dev/isdninfo | grep usage | awk '{print $3}'` != 0 ]; then
isdnctrl hangup ippp1
fi
if ps x | grep ipppd | grep -v grep >/dev/null; then
if [ `head -n 6 /dev/isdninfo | grep usage | awk '{print $2}'` != 0 ]; then
isdnctrl hangup ippp0
fi
killall ipppd
route del default
ifconfig ippp0 down
isdnctrl delif ippp0
sleep 1
echo -e "\aConnection closed."
else
echo -e "\aNot connected - nothing done."
fi
;;
*)
echo -e "\aUsage: `basename $0` <command> <options>\n"
echo -e "where <command> is one of the following:\n"
echo -e " on [2] connect to provider. with '2' option - connect on both channels."
echo -e " switch [1|2] switch between 1 or 2 channels, while connected."
echo -e " off disconnect from provider.\n"
;;
esac
# /etc/ppp/options for ipppd
/dev/ippp0
/dev/ippp1
useifip
noipdefault
ipcp-accept-local
ipcp-accept-remote
+mp
-vjccomp
-ac
-pc
-bsdcomp
-vj
lock
mru 1500
mtu 1500
debug