[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Sheflug] PPP config ... options, pap-secrets, chat script
Right ... here ye go, for those that asked (Barry) :) It *should* work okay
(I've had to reconstruct 'options' due to a rather major overhaul I did of my
PPP config some time ago to support multiple ISP's without duplicating
options, chat, et al, so I could simply add another ISP by modifying two
files: pap-secrets and one I defined that contains the ISP details. If anyone
wants this more complex setup, let me know and I'll send that one out.
All files are to go in /etc/ppp.
To config:
in chat, modify phone=, rackid=, and isp= as
appropriate. Only phone is important...rack ID
and isp are only for logging.
in pap-secrets, substitute as appropriate :) Don't
use spaces in any of the identifiers (eg use
say 'force9' rather than 'force 9'
in options, substitute 'yourusernamehere' and 'yourisp'
with the same values as you put in pap-secrets.
Also, pap-secrets may need to be chmod 600, and owned root:root (ie, so its
root read/write only and no other access)...I can't remember if PPP complains
or refuses to work if permissions allow other access. It's also more secure
anyhow :)
Remember to chmod 755 chat, else the chat script won't even run.
If you don't have a group 'dialout', make one, add yourself to it (either
indirectly with usermod or similar tools, or directly with '$EDITOR
/etc/group')...*or*...change the 'privgroup' option in options to something
that makes more sense for your setup. If unsure, create the dialout group
(dialout exists by default in SuSE; can't say for other dists).
If you don't want your modem to automatically redial if the connection drops
unexpectedly for some reason, remove the 'holdoff ...' and 'persist' lines
from options, otherwise, as I've got it setup, pppd will pause 2 seconds then
redial. Killing pppd locally doesn't cause the redial (obviously as you've
killed pppd, so it can't redial :-)
(persist tells pppd to redial, holdoff tells it how long to wait between
retries)...great on static IP and 0800 when downloading huge files *grin*
To start PPP, just type "pppd". No further command line options need be
given...the daemon has all the config it needs in /etc/ppp/options. To stop
pppd, kill the pppd daemon (the script to kill pppd is left as an exercise
for the reader) :)
I think that's everything covered, and I think I've removed all my password
info from the below config :) So see if you can break owt now :)
The only other thing that could need tweaking is that chat script itself.
Note within the chat script, I use 'AT&F1' to init the modem. If it doesn't
work as given, then you may need to change this init string. This string
works for my modem - USR/3com 56K Voice Faxmodem.
Chris...
#!/bin/sh
#
# Connect to ISP
#
set -x
exec 2> /etc/ppp/chat.debug
phone='0845xxxxxxx'
isp='Force9'
rackid='#4000'
logger -p local2.info -t chat "Dialing $isp ($rackid)..."
/usr/sbin/chat -r /etc/ppp/chat.report \
REPORT CONNECT \
TIMEOUT 3 \
ABORT '\nBUSY\r' \
ABORT '\nNO CARRIER\r' \
ABORT '\nNO ANSWER\r' \
ABORT '\nNO DIAL TONE\r' \
ABORT '\nRINGING\r\n\r\nRINGING\r' \
'' \rAT \
'OK-+++\c-OK' ATZ \
OK 'AT&F1' \
TIMEOUT 60 \
OK ATDT$phone \
CONNECT \c
##############################################################################
## Error/status processing
stat=$?
case $stat in
0) logger -p local2.info -t chat 'Chat successful';;
1) logger -p local2.info -t chat '#1: Chat script or chat command line in error';;
2) logger -p local2.info -t chat '#2: Error occoured during execution';;
3) logger -p local2.info -t chat '#3: Timeout error in script';;
4) logger -p local2.info -t chat '#4: modem got BUSY';;
5) logger -p local2.info -t chat '#5: modem got NO CARRIER';;
6) logger -p local2.info -t chat '#6: modem got NO ANSWER';;
7) logger -p local2.info -t chat '#7: modem got NO DIAL TONE';;
8) logger -p local2.info -t chat '#8: modem got RINGING...RINGING';;
*) logger -p local2.info -t chat "#${stat}: modem recieved unknown string from remote end";;
esac
if [ $stat -ne 0 ]
then
logger -p local2.info -t chat 'For further details, see the chat man page: TERMINATION CODES'
else
logger -p local2.info -t chat "`tail -1 /etc/ppp/chat.report | sed 's/.*CONNECT/CONNECT/'`"
fi
logger -p local2.info -t chat-debug "Chat stat = $stat"
logger -p local2.info -t chat 'Returning control to pppd'
exit $stat
yourusernamehere yourisp yourpasswdhere
/dev/modem
115200
0.0.0.0:
connect /etc/ppp/chat
crtscts
defaultroute
holdoff 2
idle 600
lock
modem
mru 1500
name yourusernamehere
persist
privgroup dialout
netmask 255.255.255.0
noipdefault
remotename yourisp
Chris Johnson \ "If not for me then, do it for yourself. If not
sixie@nccnet.co.uk \ for then do it for the world." -- Stevie Nicks
www.nccnet.co.uk/~sixie/ ~---------------------------------------+
Redclaw chat - http://redclaw.org.uk - telnet redclaw.org.uk 2000 \______