[LINUX][PPP-NETWORKING] Scripts for ppp stuff

From: Alexander van Koppen (alexk@odie.et.fnt.hvu.nl)
Date: 09/14/96


Hi !

Try these for a change :)

( I didn't attach 'em as I had to wipe out some passwords and so... :)    )
( The Ethernet device is *not* normally connected to the Internet, so     )
( don't expect that it (the ethernet stuff) works as far as it is present )

--- /usr/local/sbin/dial ---
$PROVTEL=<Your Provider's telephone number>
$OWNNAME=<Your Name (provider-side)>
$OWNPASS=<Your Password (provider-side)>
echo Setting up Serial Port
echo :Q | tr ':' '\001' | minicom
echo Initializing Modem
if ! chat -t4 "" ATZ OK >/dev/modem </dev/modem
then
  exit
fi
echo Dialing Host
if ! chat -t45 "" ATDT$[PROVTEL] CONNECT >/dev/modem </dev/modem then
  exit
fi
echo Logging into System.
if ! chat -t10 ame $[OWNNAME] ssword $[OWNPASS] >/dev/modem </dev/modem
then
  exit
fi
echo Preparing Connection
if ! chat -t10 PPP 4 Entering >/dev/modem </dev/modem
then
  exit
fi
sleep 3
#echo Establishing Connection
#pppd /dev/modem 38400 crtscts defaultroute netmask 255.255.255.0 passive
runppp
sleep 5
echo Ready.
--- end ---
--- /usr/local/sbin/pollmail --- (Modem on ttyS1) ---
echo Running PPPD.
if [ -e /etc/ppp/.debug ]; then
  pppd /dev/ttyS1 57600 debug crtscts netmask 255.255.255.0 passive
else
  pppd /dev/ttyS1 57600 crtscts netmask 255.255.255.0 passive
fi
--- end ---
--- /usr/local/sbin/killppp ---
kill -SIGTERM $(ps -ax | grep -e'pppd' | grep -v -e'grep' | cut -b1-6)
--- end ---
--- /usr/local/sbin/hosts.redefine ---
#!/bin/sh
#
# /usr/local/sbin/hosts.redefine:  Reworks hostnumber for 'local' host.
#
#
THISHOST=<your host name>
THISNET=<your domain name>
THISALIAS=<your host's alias>

grep -ve"${THISHOST}" -ve"# End of" /etc/hosts.orig >/etc/hosts
if [ -z $1 ]; then
  echo -n $(ifconfig ppp0 | grep -e'inet addr' | cut -f2- -d':' | cut -f-1 -d' ') >>/etc/hosts
else
  echo -n $1 >>/etc/hosts
fi
echo "	${THISHOST}.${THISNET}	${THISHOST}	${THISALIAS}" >>/etc/hosts
echo "# End of hosts." >>/etc/hosts

#End of hosts.redefine
--- end ---
--- /usr/local/sbin/hosts.restore ---
#!/bin/sh
#
# /usr/local/sbin/hosts.restore:  Restores original host numbers.
#
#

cp /etc/hosts.orig /etc/hosts >/dev/null

# End of hosts.restore
--- end ---
--- /etc/rc.d/rc.inet1 ---
#! /bin/sh
#
# rc.inet1	This shell script boots up the base INET system.
#
# Version:	@(#)/etc/rc.d/rc.inet1	1.01	05/27/93
#

HOSTNAME=`cat /etc/HOSTNAME`

# IF YOU HAVE AN ETHERNET CONNECTION, use these lines below to configure the 
# eth0 interface. If you're only using loopback or SLIP, don't include the
# rest of the lines in this file.

# Edit for your setup.
IPADDR="192.168.198.17"	# REPLACE with YOUR IP address!
NETMASK="255.255.255.0"	# REPLACE with YOUR netmask!
NETWORK="192.168.198.0"	# REPLACE with YOUR network address!
BROADCAST="192.168.198.255"	# REPLACE with YOUR broadcast address, if you
			# have one. If not, leave blank and edit below.
GATEWAY="193.67.18.1"	# REPLACE with YOUR gateway address!

# Attach the loopback device.
/sbin/ifconfig lo 127.0.0.1
/sbin/route add -net 127.0.0.0

RELEASE=$(/bin/uname -r)

# Attach the ethernet device (if wanted)
if [ -e /etc/.flags/.ethernet ]; then
  /sbin/insmod /usr/src/linux-${RELEASE}/drivers/net/3c509.o
fi

if dmesg | grep -qe'eth0'; then
  /sbin/ifconfig eth0 ${IPADDR} broadcast ${BROADCAST} netmask ${NETMASK}
else
  /sbin/ifconfig dummy ${IPADDR} up
fi
/sbin/route add -net ${NETWORK}

# End of rc.inet1
--- end ---
--- /etc/ppp/ip-up ---
#! /bin/sh
#
# ip-up		This shell script handles new ppp links.
#
# Version:	@(#)/etc/ppp/ip-up	1.00	11/06/96
#
logger "PPP: Running IP-Up."
logger "PPP: Resetting ip-adres"
logger $(/usr/local/sbin/hosts.redefine $4)
logger "PPP: Settling down."
logger $(/bin/sleep 5 2>&1)
logger "PPP: Sending queued mail."
logger $(/usr/sbin/sendmail -bm -q 2>&1)
logger "PPP: Ready."

# End of ip-up
--- end ---
--- /etc/ppp/ip-down ---
#! /bin/sh
#
# ip-down	This shell script handles lost ppp links.
#
# Version:	@(#)/etc/ppp/ip-up	1.00	11/06/96
#

logger "PPP: Running IP-Down."
logger "PPP: Restoring ip-adres."
logger $(usr/local/sbin/hosts.restore)

#end of ip-down
--- end ---

Hope this works :) (It does for me :) )

See ya, 
  Alex.

> Recently someone was having trouble setting up networking with an ethernet 
> card, I'm also getting linux 'hooked' up to the net.  I need help with setting 
> up ppp, i have read alot of doc files, help files, HOWTO's and such, and still 
> no avail, I was wondering if anyone had a script that works like ppp-on or 
> something, I might not have my modem set up correctly.  What happens when I try 
> to execute the ppp-on script, it always fails, I mean I don't hear a dial tone 
> or anything.  I know I should be more descriptive but all the things I have 
> tried would take forever, if I knew linux like the back of my hand I could 
> probably troubleshoot the problem, whereas I don't, so any help would be 
> appreciated.
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/18/00 PST