A dialin server is used for remote access of a mainframe via modem
communications. The server waits for the modem to issue the 'RING'
command and then proceeds to answer and negotiate communications
with the client.
The most popular application for a dialin server is to allow network
access for clients. The initial prompt will allow shell account access
but the client may also envoke the pppd daemon for PPP communications.
The PPP protocol will allow the client to browse the network intranet
or the external internet.
If your setup will allow the PPP protocol to browse the internet, it is
also recommended that you setup your own DNS server to cache hostname
resolutions. This will maximize bandwidth on the network gateway.
Dialin Applications:
The following programs can be used for dialin access:
mgetty - Supports fax and voice. Less features that uugetty.
vgetty - Part of mgetty, the voice support application.
uugetty - No support for fax or voicemail.
Mingetty only supports console logins and is used by most linux systems.
You can obtain information on mgetty at:
http://www.leo.org/~doering/mgetty/
http://alpha.greenie.net/mgetty/
Mgetty Overview:
getty is usually started in the bootstrap phase. When another
modem calls your modem, either the modem can answer the ring
or getty can send a signal to the modem instructing it to answer
the call. By setting the S0 register on the modem to 3, the
modem will automatically answer the call on the 3rd ring. If
S0 is set to 0, the modem will not answer. The modem will then
have to be instructed by getty with the ATA command to answer
the call. If getty instructs the modem to answer the call in
place of the modem automatically answering, it is called a
"manual answer".
The manual answer approach is considered a good choice because
if something is wrong with the computer but the modem is still
operational (mostly with external modems), the modem will
answer the call but no login prompt will appear. This is not
desirable when long-distance charges may apply or the user
may wait hopelessly for the login prompt.
Mgetty Setup:
Mgetty cannot be called with a simple shell command or startup
script as in /etc/rc.d. Mgetty must be called by the init process
and configured accordingly in the /etc/inittab configuration file.
During the bootstrap phase, the linux operating system calls the
init process which is responsible for making sure that the gettys
are running on the appropriate i/o device (virutal terminals,
serial lines, and modems).
When mgetty is started, it checks if a valid lock file held by
another process is present. If it is, this means the port is in
use, and mgetty will wait until the lock file goes away. Once
the lock file is removed, mgetty creates it's own lock file,
initializes the modem and removes its lock file. Mgetty then
watches the port for data by using the poll() or select() method.
The two types of port activities mgetty will detect are a dialout
or a dialin. In the first case, a dialout will have created a
lock file and mgetty will wait for it to go away, and then exit.
Init will start a fresh mgetty process and then wait for a call.
In the second case, when there is no lock file, mgetty creates
a lock file and reads the characters available. If it finds a
'RING', it picks up the phone by sending 'ATA' and waits for the
'CONNECT' message. If the call is a fax, it saves the file in the
'FAX_SPOOL_IN' (usually '/var/spool/fax/incoming') and exits.
If the call is a modem, it prints '/etc/issue' and displays a
login prompt. Once it has received a login string, it calls
'/bin/login' and lets it handle things from here.
A typical lock file for serial port devices are in a file called
'/usr/spool/uucp/LCK..ttyxx', containing the process ID (PID) of
the process currently using the device.
The /etc/inittab Entry:
The typical 'inittab' entry for mgetty looks like this:
tt:rlevel:respawn|off:/usr/local/sbin/mgetty [options] device
F1a:23:respawn:/usr/local/sbin/mgetty -x 3 ttyS1
Once the /etc/inittab file is updated, you must restart init
with the a HUP signal (kill -1 1).
Options:
-x level - Sets the debuging level.
-s speed - Sets the port speed.
-k space - Minimum kb required on an incoing fax directory.
-m 'rx tx' - Sets the modem initialization sequence. (-r).
-p - Sets the login prompt (escapes are allowed).
-n rings - Sets the number of ring before answer.
-R n - Enables ringback mode. Call back in n seconds.
-i '/etc/issue' - Specifies the issue file to display.
-S faxdoc - G3 document sent to polling fax machines (full path).
To Deny Logins:
Mgetty will not answer the phone is a file is created in the /etc
directory. This file looks like this: '/etc/nologin.ttyS2'. This
will prevent answers when login processes are not allowed or when
the line is being used as a voice line. You can configure cron
jobs to automate desired timing and parameter configurations.
Direct Serial Lines:
To use a direct serial line between two unix machines, or a unix
Machine and some other machine, use the -r flag. This will prevent
mgetty from trying to initialize the modem or wait for RINGs. This
setup may be useful for leased line modems also.