[ Pobierz całość w formacie PDF ]
.pidecho "ERROR: Removed stale pid file" 282 Advanced Featuresexit 1fi## Success.Let pppd clean up its own junk.echo "PPP link to $DEVICE terminated."exit 0fi## The ppp process is not running for ppp0echo "ERROR: PPP link is not active on $DEVICE"exit 16.2.4 Editing the supplied PPP startup scripts.As the new scripts come in two parts, and we will edit them in turn.The ppp-on script.You will need to edit the ppp-on script to reflect YOUR username at your ISP, YOUR password at your ISP, the telephone number of your ISP.Each of the lines like TELEPHONE= actually set up shell variables that contain theinformation to the right of the  = (excluding the comments of course).So edit each ofthese lines so it is correct for your ISP and connection.Also, as you are setting the IP number (if you need to) in the /etc/ppp/options file,DELETE the line that says:$LOCAL_IP:$REMOTE_IP \Also, make sure that the shell variable DIALER SCRIPT points at the full path andname of the dialer script that you are actually going to use.So, if you have moved this orrenamed the script, make sure you edit this line correctly in the ppp-on script!Theppp-on-dialerscript.This is the second of the scripts that actually bringsup our ppp link.Note: a chat script is normally all on one line.the backslashes are used to allow linecontinuations across several physical lines (for human readability) and do not form part ofthe script itself.However, it is very useful to look at it in detail so that we understand what it is actually(supposed) to be doing! Dial-up Networking with PPP 283A chat script is a sequence of  expect string  send string pairs.In particular, note thatwe ALWAYS expect something before we send something.If we are to send something WITHOUT receiving anything first, we must use an emptyexpect string (indicated by   ) and similarly for expecting something without sending any-thing! Also, if a string consists of several words, (e.g.NO CARRIER), you must quote thestring so that it is seen as a single entity by chat.The chat line in our template is:exec /usr/sbin/chat -vInvoke chat, the -v tells chat to copy ALL its I/O into the system log (usually/var/log/messages).Once you are happy that the chat script is working reliably, edit thisline to remove the -v to save unnecessary clutter in your syslog.TIMEOUT 3This sets the timeout for the receipt of expected input to three seconds.You may needto increase this to say 5 or 10 seconds if you are using a really slow modem!ABORT  \nBUSY\rIf the string BUSY is received, abort the operation.ABORT  \nNO ANSWER\rIf the string NO ANSWER is received, abort the operationABORT  \nRINGING\r\n\r\nRINGING\r\begin{verbatim} \end{tscreen}If the (repeated) string RINGING is received, abort the operation.This is because someone is ringing your phone line!\begin{tscreen} \begin{verbatim}" \rATExpect nothing from the modem and send the string AT.OK-+++\c-OK ATH0 284 Advanced FeaturesThis one is a bit more complicated as it uses some of chat s error recovery capabilities.What is says is.Expect OK, if it is NOT received (because the modem is not in com-mand mode) then send +++ (the standard Hayes-compatible modem string that returns themodem to command mode) and expect OK.Then send ATH0 (the modem hang up string).This allows your script to cope with the situation of your modem being stuck on-line!TIMEOUT 30Set the timeout to 30 seconds for the remainder of the script.If you experience troublewith the chat script aborting due to timeouts, increase this to 45 seconds or more.OK ATDT$TELEPHONEExpect OK (the modem s response to the ATH0 command) and dial the number wewant to call.CONNECT  Expect CONNECT (which our modem sends when the remote modem answers) andsend nothing in reply.ogin:--ogin: $ACCOUNTAgain, we have some error recovery built in here.Expect the login prompt (.ogin:) butif we don t receive it by the timeout, send a return and then look for the login prompt again.When the prompt is received, send the username (stored in the shell variable $ACCOUNT).assword: $PASSWORDExpect the password prompt and send our password (again, stored in a shell variable).This chat script has reasonable error recovery capability.Chat has considerably morefeatures than demonstrated here.For more information consult the chat manual page (man8 chat).6.2.5 Starting PPP at the server end.While theppp-on-dialerscript is fine for servers that automatically start pppd atthe server end once you have logged in, some servers require that you explicitly start PPPon the server.If you need to issue a command to start up PPP on the server, you DO need to edit theppp-on-dialer script. Dial-up Networking with PPP 285At the END of the script (after the password line) add an additional expect send pairthis one would look for your login prompt (beware of characters that have a special meaningin the Bourne shell, like$[]Once chat has found the shell prompt, chat must issue the ppp start up command re-quired for your ISPs PPP server.In one author s case, the PPP server uses the standard Linux Bash prompt[hartr@kepler hartr]$which requires the response# pppto start up PPP on the server.It is a good idea to allow for a bit of error recovery here, so usehartr--hartr pppThis says, if we don t receive the prompt within the timeout, send a carriage return andlooks for the prompt again.Once the prompt is received, then send the string ppp.Note: don t forget to add a to the end of the previous line so chat still thinks the entirechat script is on one line!Unfortunately, some servers produce a very variable set of prompts! You may needto log in several times using minicom to understand what is going on and pick the stable expect strings.6.2.6 If your PPP server uses PAP (Password Authentication Proto-col) [ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • necian.htw.pl