dip handles the connections needed for dialup IP links, like SLIP or
PPP. It can handle both incoming and outgoing connections, using
password security for incoming connections. The outgoing connections
use the system's dial(3) library if available.
The first form interprets scriptfile to dial out and open an IP connection
(see DIALOUT MODE below).
The -t option runs dip interactively (see COMMAND MODE below).
This is most useful while gathering data to set up a chat script.
dip -i handles incoming connections (see DIALIN MODE below).
diplogin is equivalent to dip -i, and diplogini
is equivalent to dip -i -a. These are mainly for use with
versions of login(1) that do not pass command line
parameters to the shell program.
dip -k kills an existing dip process, closing the connection.
Prompt for user name and password.
Act as a dialin server (see DIALIN MODE below).
Kill the dip process that runs (has locked) the specified tty device
(see -l option),
or else the most recent invocation of dip.
Note that dip
takes care not to kill a process started by somebody
else (unless it's root who demands the operation :-).
Indicate the line to be killed. (Requires -k option.)
Set the Maximum Transfer Unit (MTU) (default 296).
Set the line protocol. proto must be one of: SLIP, CSLIP, PPP, or TERM.
Run in test mode (see COMMAND MODE below).
Set verbose mode. This enables various debug printouts, including
an echo of each line of the chat script.
The first possible use of
is as an interactive program to set up an outgoing IP connection.
This can be done by invoking
option, which means
enter TEST mode
and, more precisely, dumps you in the
of the dip program. You are reminded of this by the
prompt, or, if you also specified the
debugging flag, the
prompt. The latter prompt also displays the current value of the
variable, which is used mostly when dip runs in
mode. For the interactive mode, it can be used to determine if the
result of the previous command was OK or not.
The following is a sample taken from a live session:
DIP: Dialup IP Protocol Driver version 3.3.7n-uri (7 Mar 95)
Written by Fred N. van Kempen, MicroWalt Corporation.
The possible commands are listed below (see COMMANDS).
Note particularly the help command.
Each command displays a usage message if it is
invoked incorrectly. Just experiment a little
to get the feel of it, and have a look at the sample script
file, which also uses this command language (see EXAMPLES).
The second way of using
is to initiate outgoing connections.
To make life easier for the people who have to manage links of this type,
to set up a link to a remote system. This gives the user an
enormous amount of flexibility when making the connection,
which otherwise could require many command-line options.
The path name of the script to be run
is then given as the single argument to dip. If scriptfile
has no file extension, dip will automatically add the extension ".dip".
This is just a way to group scripts together in a single directory.
The third possible way of using
is as a login shell for incoming IP connections, as in dialup
SLIP and PPP connections. To make integration into the existing
UNIX system as easy as possible,
can be installed by simply naming it as the login shell in /etc/passwd.
A sample entry looks like:
logs in, the
program sets the home directory to /tmp and executes the
program. diplogin should be a symbolic link to
dip, which means that
must run in
then tries to locate the name of the logged in user (i.e. the
name corresponding to its current user id, as returned by the
system call) in its database file. An optional single argument
program in this mode can be the username that must be used in
this lookup, regardless the current user id.
now scans /etc/diphosts for an entry for the given user name.
This file contains lines of text (much like the standard password file).
Any line starting with # is a comment.
Otherwise, each line has seven colon-separated items, in the format
user : password : remote host : local host : netmask :
comments : protocol,MTU
The first field of a line is the user name, which we must
The second field can contain an encrypted password. If this
field is non-null,
displays the prompt "External security password:", and the reply must
match the password in this field. If this field is
"s/key" (check the value of SKEY_TOKEN in dip.h) and dip
was compiled with S/Key enabled, then S/Key authentication
will take place (see README.SKEY in the dip source directory).
The third field
contains the name (or raw IP address) of the remote host.
If a host name is given, the usual
address resolving process is started, using either a name server or
a local hosts file.
The fourth field contains the name (or raw IP address) of the local host.
If a host name is given, it's resolved, just like the remote
host name in the third field.
The fifth field contains the netmask in decimal dotted notation
(like 255.255.255.0). If empty, 255.255.255.0 is used by default.
The sixth field may contain any text; it is not used by dip.
Finally, the seventh field of a line contains a mixture
of comma-separated flags. Possible flags are:
to indicate we must use the SLIP protocol.
to indicate Compressed SLIP protocol.
to indicate we must use the PPP protocol.
which gives the MTU parameter of this connection.
Please note: my experience shows smaller blocks (i.e. smaller MTU) work
better. You *can* define MTU 1500, but it won't vouch for your sanity.
After finding the correct line,
puts the terminal line into
mode, and asks the system networking layer to allocate a channel
of the desired protocol. Finally, if the channel is activated,
it adds an entry to the system's
table to make the connection work.
now goes into an endless loop of sleeping, which continues until
the connection is physically aborted (i.e. the line is dropped).
At that time,
removes the entry it made in the system's routing table, and
releases the protocol channel for re-use. It then exits, making
room for another session.
The following may appear in a chat script. Most can also be used
in command mode:
Define a label.
Beep on user's terminal [this many times].
bootp [howmany [howlong]]
Use BOOTP protocol to fetch local and remote IP addresses.
Send a BREAK.
Add to dip's collection of modem response words.
Get or ask for the value of a variable.
If the second parameter is ask, a prompt is printed and the value
is read from standard input. If it is remote, it is read
from the remote machine. Otherwise, the second parameter is a constant
or another variable which supplies the value.
Transfer control to the indicated label in the chat script.
Print list of commands, similar to this:
DIP knows about the following commands:
beep bootp break chatkey config databits
dec default dial echo flush get
goto help if inc init mode
modem netmask onexit parity password proxyarp
print port quit reset securidf securid
send shell sleep speed stopbits term
Test some result code. The expr must have the form
$variable op constant
where op is one of: == != < > <= >=.
Increment a variable. The default increment-value is 1.
Set the initialization string (sent to the modem before
dialing) to the indicated string (default ATE0 Q0 V1 X1).
Please use it!
Set the line protocol (default SLIP).
Set the type of modem.
(The default, and at present the only legal value, is HAYES).
Indicate the netmask we will want to use.
Description is missing - look through the source in command.c.
Or ask <inaky@@peloncho.fis.ucm.es> - he wrote it (:-).
Set the type of parity.
Prompt for a password and send it.
Request Proxy ARP to be set.
Print the contents of some variable.
Send the output of command to the serial driver, optionally passing
arguments to command. The UID is reset to the real UID before
Set the name of the terminal port to use. (The path /dev/ is assumed.)
Exit with nonzero exit status.
Reset the modem. (Sends "+++" then "ATZ".)
Store the fixed part of the SecureID password.
Prompt for the variable part of the password generated
by the ACE System SecureID card.
The fixed part of the password must already have been stored
using a secureidf command.
The two parts are concatenated and sent to the remote terminal server.
Send a string to the serial driver.
Executes command through the default shell (obtained from the SHELL
variable) with parameters as the command-line arguments. Dip
variable substitution is performed before executing the command. If you don't
want a parameter beginning with a $ to be interpreted as a dip variable,
precede it with a \.
skey [timeout | $variable]
This tells dip to look for an S/Key challenge from the remote
terminal server. dip then prompts the user for the secret
password, generates the response, and sends it to the remote host. The
optional parameter timeout sets how long dip is to wait to
see the challenge. $errlvl is set to 1 if the skey command
times out. If skey successfully sends a response, $errlvl is
set to 0. Requires S/Key support to be compiled in.
Wait some time.
Set port speed (default 38400).
Note that the actual speed associated with "38400" can be changed
using setserial(8). Also, you should tell port's real
speed here, as dip takes care of the set_hi and such
bits by itself. Also, don't be afraid, if you told the speed
"57600" and it reports back "38400" - everything's OK, the
proper flags were applied and the real port speed will be
what you told it to be, i.e. "57600".
Set the number of stop bits.
Enter a terminal mode.
Set timeout. This defines the period of inactivity on the line, after
which DIP will force the line down and break the connection (and exit).
waittext [timeout_value | $variable]
Wait for some string to arrive.
Holds the result of the previous command.
IP number of local host in dotted quad notation (for example, 184.108.40.206).
Fully qualified local host name (for example, sunsite.unc.edu).
IP number of remote host in dotted quad notation.
Fully qualified remote host name.
Maximum Transfer Unit (maximum number of bytes transferred at once).
Modem type (at present the only valid value is HAYES).
The name of the terminal port to use. (The path /dev/ is assumed.)
Transfer rate between the local host and the modem, in bits/sec.
Here is a sample /etc/diphosts:
# diphosts This file describes a number of name-to-address
# mappings for the DIP program. It is used to determine
# which host IP address to use for an incoming call of
# some user.
# Version: @(#)diphosts 1.20 05/31/94
# Author: Fred N. van Kempen, <email@example.com>
# Modified: Uri Blumenthal <firstname.lastname@example.org>
# name : pwd : hostname : local server: netmask: comments : protocol,mtu
sbonjovi::bonjovi:server1:netmask:MicroWalt "bonjovi" SLIP:SLIP,296
sroxette::roxette:server2:netmask:MicroWalt "roxette" SLIP:CSLIP,296
stephen:s/key:tuin:server3:netmask:S/Key Authenticated login:CSLIP,296
# End of diphosts.
A chat script should look something like this:
# sample.dip Dialup IP connection support program.
# Version: @(#)sample.dip 1.40 07/20/93
# Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
# First of all, set up our name for this connection.
# I am called "uwalt.hacktic.nl" (== 220.127.116.11)
get $local uwalt.hacktic.nl
# Next, set up the other side's name and address.
# My dialin machine is called 'xs4all.hacktic.nl' (== 18.104.22.168)
get $remote xs4all.hacktic.nl
# Set netmask on sl0 to 255.255.255.0
# Set the desired serial port and speed.
# Reset the modem and terminal line.
# This seems to cause trouble for some people!
# Note! "Standard" pre-defined "errlvl" values:
# 0 - OK
# 1 - CONNECT
# 2 - ERROR
# 3 - BUSY
# 4 - NO CARRIER
# 5 - NO DIALTONE
# You can change these with the chatkey command
# Prepare for dialing.
wait OK 2
if $errlvl != 0 goto modem_trouble
if $errlvl != 1 goto modem_trouble
# We are connected. Login to the system.
wait ogin: 20
if $errlvl != 0 goto login_error
wait ord: 20
if $errlvl != 0 goto password_error
# We are now logged in.
wait SOMETEXT 15
if $errlvl != 0 goto prompt_error
# Set up the SLIP operating parameters.
get $mtu 296
# Ensure "route add -net default xs4all.hacktic.nl" will be done
# Say hello and fire up!
print CONNECTED $locip ---> $rmtip
print TIME-OUT waiting for SLIPlogin to fire up...
print Trouble waiting for the Login: prompt...
print Trouble waiting for the Password: prompt...
print Trouble occurred with the modem...
print CONNECT FAILED to $remote
This script causes
to dial up a host, log in, and get a
interface channel going (in the same manner as with incoming
connections). When all is set up, it simply goes into the background
and waits for a hangup (or just a lethal signal), at which it hangs
up and exits.