Dial Up pripojeni

Pavel Machek pavel na elf.ucw.cz
Pátek Březen 6 15:49:23 CET 1998


Ahoj!

> Pokousel jsem se v Linuxu nakonfigurovat DialUP pripojeni (po telefonu).
> Nakonfiguroval jsem PPP ale netusim co dal. Nevim jak vytocit linku.
> Modem mi treba v Miniconu chodi. Nevite nekdo jak dal ? Nebo jestli je
> nekde o tom nejaky souhrny dokument ?

Proste pustte tenhle skript. Me to chodilo :-).

#!/bin/sh
###############################################################################
#
#	PPPSETUP  --  Script to set up pppd
###############################################################################

echo
echo "PPPSETUP"
echo 
echo "You have to be root to run this procedure"
echo
echo "answer all that apply and leave blank what does"
echo "not apply....leave blank by hitting [enter]"
echo "					press [enter]"
read x
clear

if [ ! `whoami` = "root" ]; then
	echo "You must be root to run this script."
	exit 1
fi

while [ -z "$PHONENUM" ]
do
	echo
	echo "To begin setting up your PPP connection, I need to know a "
	echo "few things.  For starters, what is the phone number of your"
	echo "Internet service provider?"
	echo
	echo "(Note: in the USA, use *70, [comma required!] to turn off call"
	echo " waiting.)"
	echo
	echo -n "Phone number : "
	read PHONENUM
	if [ -z "$PHONENUM" ]; then
		echo "You must enter a phone number!  :)"
		sleep 1
	fi
done

if [ -e "/dev/modem" ]; then
	echo
	echo -n "Found your modem...("
	echo -n `ls -l /dev/modem | cut -b56-80`
	echo ")"
	echo
	DEVICE="/dev/modem"
else
	while [ -z "$DEVICE" ]
	do
		echo
		echo "Secondly, what is the name of your modem device?"
		echo
		echo "	1) /dev/cua0  (COM1: under DOS)"
		echo "	2) /dev/cua1  (COM2: under DOS)"
		echo "	3) /dev/cua2  (COM3: under DOS)"
		echo "	4) /dev/cua3  (COM4: under DOS)"
		echo
		echo -n "Select device : "
		read devnum

		case $devnum in
			1)
				DEVICE="/dev/cua0"
				;;
			2)
				DEVICE="/dev/cua1"
				;;
			3)
				DEVICE="/dev/cua2"
				;;
			4)
				DEVICE="/dev/cua3"
				;;
			*)
				echo "Sorry, $devnum isn't a legal selection."
				;;
		esac
	done
fi

while [ -z $BAUDRATE ]
do
	echo
	echo "What baud rate is your modem?"
	echo
	echo "   0)115200    (Yeeeee-HAW!!!           )"
	echo "   1) 38400    (Hangin' ten on the 'net!)"
	echo "   2) 19200    (Better known as 14.4    )"
	echo "   3)  9600    (Kinda pokey, ain'tcha?  )"
	echo "   4)  2400    (God help you.  :>       )"
	echo
	echo -n "Baud rate : "
	read baudnum

	case $baudnum in
		0)
			BAUDRATE="115200"
			;;
		1)
			BAUDRATE="38400"
			;;
		2)
			BAUDRATE="19200"
			;;
		3)
			BAUDRATE="9600"
			;;
		4)
			BAUDRATE="2400"
			;;
		*)
			echo "Sorry, $baudnum isn't a legal selection."
			sleep 1
			;;
	esac
done

echo
echo "What is the IP address of your Internet provider's nameserver?"
echo
echo "Note: Your service provider's technical support can provide you"
echo "with this information."
echo
echo -n "Nameserver IP : "
read DNSIP

echo >> /etc/resolv.conf
echo "nameserver $DNSIP" >> /etc/resolv.conf

OLDDIR=`pwd`
cd $HOME

echo
echo "Now comes the tough part.  :)  I need to know what your"
echo "dialup system prints to your screen, and I need to know what"
echo "you respond with."
echo
echo "( End with '***')"
echo
echo "ABORT BUSY ABORT 'NO CARRIER' '' ATDT$PHONENUM" > .pppscript
while [ ! "$MESSAGE" = "***" -a ! "$YOUSAY" = "***" ]
do
	echo -n "Dialup server says : "
	read MESSAGE

	if [ "$MESSAGE" = "***" ]; then
		continue
	fi

	echo -n "    ...and you say : "
	read YOUSAY

	if [ "$YOUSAY" = "***" ]; then
		continue
	fi

	echo "$MESSAGE $YOUSAY" >> .pppscript
done

rm -f ppp-go
echo "#!/bin/sh" > ppp-go
echo "/usr/sbin/pppd connect '/usr/sbin/chat -f $HOME/.pppscript' defaultroute $BAUDRATE $DEVICE &" >> ppp-go
chmod 755 ppp-go

cd $OLDDIR
echo
echo "To connect to your remote system, cd to your home directory ($HOME), and type:"
echo "./ppp-go"
echo
echo "Then wait 2 minutes or so.  You should be able to use your Internet applications"
echo "without a problem.  (Hopefully. ;)"
echo
echo "You should only have to run this procedure ounce unless something changes"
echo "with your provider or personal setup. To start PPP from here on out just"
echo "type from your home dir ppp-go"
echo 
echo "If your pppd and chat bins reside someplace other than"
echo "/usr/sbin then you will need to edit the ppp-go and .pppscript"
echo "files to reflect the location, usually /usr/lib/ppp for older"
echo "distributions like Slackware-2.*"
echo 
echo "I can be reached via email at wingman na infohwy.com "
echo "or in the #linux channel on IRC with the nick WingMan"machek na atrey:~$ 


-- 
I'm really pavel na atrey.karlin.mff.cuni.cz. 	   Pavel
Look at http://atrey.karlin.mff.cuni.cz/~pavel/ ;-).


Další informace o konferenci Linux