Shell Script for PPPing to TRC

Warning! This page is only for TRC people. PPP connection to TRC Unix machines is not allowed for other people. However, other people may copy and modify the scripts.
Created: 7/27/95, Modified: 7/29/95.

O Explanation

This page contains shell script for PPP connection from a Linux box to TRC Unix machines. The first script is for normal PPP connection. The second is for call-back connection. The third is used by the first and second scripts. The name of this script is trcppp.

You have to replace ||...|| by the host IP address that you want to connect, the phone number of the host, your user id, and your password.

The script works (at least on my Linux bos), but may have bugs. Sorry!

O Normal PPP Connection Script

#!/bin/sh
PHONE_NUMBER=||XX-XXXX||	# Phone number for sh1, sh2 or ...
PPP_HOST=||163.220.1.10||	# 163.220.1.10=sh1, 163.220.1.9=sh2, ...
PPP_UID=||user id||
PPP_PASSWD=||password||
CALLBACK=
export PHONE_NUMBER PPP_UID PPP_PASSWD PPP_HOST CALLBACK
PPP_ABORT='ABORT "NO CARRIER" ABORT BUSY'
trcppp

O Call-back PPP Connection Script

#!/bin/sh
PHONE_NUMBER=||XX-XXXX||	# Phone number for sh1, sh2 or ...
PPP_HOST=||163.220.1.10||	# 163.220.1.10=sh1, 163.220.1.9=sh2, ...
PPP_UID=||user id||
PPP_PASSWD=||password||
CALLBACK='rwcp.or.jp> callme else\) 1 \(y/n\) y'
export PHONE_NUMBER PPP_UID PPP_PASSWD PPP_HOST CALLBACK
PPP_ABORT='ABORT BUSY'
trcppp

O Subroutine

#!/bin/sh
#
#	Set up a PPP link
#
LOCKDIR=/var/spool/uucp
PPPDIR=/usr/lib/ppp
DEVICE=cua1

if [ -f $LOCKDIR/LCK..$DEVICE ]
then
    echo "Unlocking PPP device..."
    $PPPDIR/unlock LCK..$DEVICE
fi

$PPPDIR/fix-cua $DEVICE

(
    stty 38400 -tostop

    if $PPPDIR/chat -v -l LCK..$DEVICE $PPP_ABORT \
	"" ATZ OK ATE1Q0V1X3S0=1DP$PHONE_NUMBER CONNECT "" ogin: $PPP_UID \
	ssword: $PPP_PASSWD $CALLBACK \
	rwcp.or.jp\> "exec /usr/local/etc/pppshell"
    then
	echo "OK chat" 1>&2
	$PPPDIR/pppd -detach mru 1500 /dev/$DEVICE &
	sleep 5
	/sbin/route add -net 163.220.0.0 gw $PPP_HOST
	exit 0
    else
	echo "PPP call failed" 1>&2
	exit 1
    fi
) < /dev/$DEVICE > /dev/$DEVICE

Y. Kanada (Send comments to yasusi @ kanadas.com)