Using chat to Automate Dialing
One of the things that may have struck you as inconvenient in the
previous example is that you had to establish the connection manually
before you could fire up pppd. Unlike
dip, pppd does not have its own
scripting language for dialing the remote system and logging in, but
relies on an external program or shell script to do this. The
command to be executed can be given to pppd with
the connect
command-line
option. pppd will redirect the command’s standard
input and output to the serial line.
The pppd software package is supplied with a very simple program called chat, which is capable of being used in this way to automate simple login sequences. We’ll talk about this command in some detail.
If your login sequence is complex, you will need something more
powerful than chat. One useful alternative you
might consider is expect, written by Don Libes. It
has a very powerful language based on Tcl, and was designed exactly for
this sort of application. Those of you whose login sequence requires,
for example, challenge/response authentication involving
calculator-like key generators will find
expect powerful enough to handle the task. Since
there are so many possible variations on this theme, we won’t describe
how to develop an appropriate expect script in this book. Suffice it
to say, you’d call your expect script by specifying its name using the
pppd
connect
option. It’s also important to note that when the script is running, the standard input and ...
Get Linux Network Administrator's Guide, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.