
Below is the chatscript used to dial BTi, I've now opted for putting the \T metacharacter in the script. The means when we run chat, inside the pppd command, we can use a -T parameter and supply the needed telephone number.
"" "ATZ" # The next two lines should be left commented out until # the script works. # "OK" "ATL0" # "OK" "ATM0" SAY "Dialing modem...\n" "OK" "ATDT \T" ABORT BUSY ABORT "NO CARRIER" TIMEOUT 60 CONNECT \c |
This script will dial BTi providing you put in the \T so we can added the telephone number later. I suggest saving the chatscript as something like /etc/ppp/chatscript Once you've saved it we can move onto setting up BTi's CHAP authentication.
In the /etc/ppp directory should be a chap-secrets that looks roughly like this when first installed:
# Secrets for authentication using CHAP # client server secret IP addresses |
We can safely ignore the IP Address column but the others me must worry about. So fill in the gaps like this:
# Secrets for authentication using CHAP # client server secret IP addresses "bloggs@btinternet.com" * "mypasswordhere" |
These two extra lines will try and authenticate ANY outgoing PPP connection that responds using CHAP using your BTi details. It goes without saying that you replace bloggs@btinternet.com and mypasswordhere with your details. Also, the second line is not strictly needed but I've found it helps sometimes.
Note: If you're not using BTi at this point you can usually get away with having identical chap-secrets and pap-secrets. If you the same kind of pattern as above it should work.
I suggest that you do a "chmod 600 /etc/ppp/*secrets". It was pointed out to me that it stops pppd shouting about security.
lock |
And thats it, now we need to add some more settings in here so make it look like:
lock usepeerdns defaultroute noipdefault noauth asyncmap 0 crtscts modem 115200 |
Don't worry what they do, if you're interested look at the man page for pppd. As a passing note if you would like PPPd to redial dropped connections then add persist to the end of your options file.
To test your link try this command:
pppd ttyS0 connect '/usr/sbin/chat -v -TPHONE_NUM_HERE -f /etc/ppp/chatscript' updetach debug name bloggs@btinternet.com
Now obviosuly if your testing at Daytiem rate add the Daytiem number where instead of PHONE_NUM_HERE and similar with Surftime.
This will tell PPPd to dial the modem on ttyS0 (COM1) using the chatscript. The updetach tells PPPd to only fork away to the commandline after the connection is established and the debug will show all authentication commands onscreen (providing updetach it set) while it trys to connect.
If that connected then move onto the next section and we can make a set of scripts to allow easy dialing.
/etc/ppp/peers/bt-surf
ttyS0 connect '/usr/sbin/chat -v -TSURFTIME_NUMBER_HERE -f /etc/ppp/chatscript' updetach name bloggs@btinternet.com |
/etc/ppp/peers/bt-day
ttyS0 connect '/usr/sbin/chat -v -TDAYTIME_NUMBER HERE -f /etc/ppp/chatscript' updetach name bloggs@btinternet.com |
Change any of the filenames to suit what you called them and the username. Do the same with this:
/usr/bin/internet
#!/bin/bash
# a script to dial BTi
case "$1" in
daytime)
/usr/sbin/pppd call bt-day
;;
surftime)
/usr/sbin/pppd call bt-surf
;;
off)
killall pppd
;;
esac
|
Once you've done that run this command at the command prompt:
chmod a+x /usr/bin/internet
Now you've done, simply type internet daytime/surftime/off and it will connect you to the internet.