Using dip
Now that was rather simple. Nevertheless, you might want to automate the steps previously described. It would be much better to have a simple command that performs all the steps necessary to open the serial device, cause the modem to dial the provider, log in, enable the SLIP line discipline, and configure the network interface. This is what the dip command is for.
dip means
dip provides an interpreter for a simple scripting language that can handle the modem for you, convert the line to SLIP mode, and configure the interfaces. The script language is powerful enough to suit most configurations.
To be able to configure the SLIP interface, dip requires root privilege. It would now be tempting to make dip setuid to
A Sample Script
Assume that the host to which we make our SLIP connection is
# dip cowslip.dip
DIP: Dialup IP Protocol Driver version 3.3.7 (12/13/93)
Written by Fred N. van Kempen, MicroWalt Corporation.
connected to cowslip.moo.com with addr 192.168.5.74
#
The script itself is shown in Example 7.1.
Example 7.1: A Sample dip Script
# Sample dip script for dialing up cowslip
# Set local and remote name and address
get $local vlager-slip
get $remote cowslip
port ttyS3 # choose a serial port speed
38400 # set speed to max
modem HAYES # set modem type
reset # reset modem and tty
flush # flush out modem response
# Prepare for dialing.
send ATQ0V1E1X1
wait OK 2
if $errlvl != 0 goto error
dial 41988
if $errlvl != 0 goto error
wait CONNECT 60
if $errlvl != 0 goto error
# Okay, we're connected now
sleep 3
send
wait ogin: 10
if $errlvl != 0 goto error
send Svlager
wait ssword: 5
if $errlvl != 0 goto error
send knockknock
wait running 30
if $errlvl != 0 goto error
# We have logged in, and the remote side is firing up SLIP.
print Connected to $remote with address $rmtip
default # Make this link our default route
mode SLIP # We go to SLIP mode, too
# fall through in case of error
error:
print SLIP to $remote failed.
After connecting to
# dip -k
In dip 's scripting language, keywords prefixed with a dollar symbol denote variable names. dip has a predefined set of variables, which will be listed below.
The first two statements in the sample script are get commands, which is dip 's way to set a variable. Here, the local and remote hostnames are set to
The next five statements set up the terminal line and the modem.
The final commands executed after logging in are
