7 How do I dial in and out with my modem?

Contents of this section

Get your modem to dial out correctly.

7.1 Dial in and out modem configuration

For dial in and dial out use, you have to set up your modem a certain way (again, using the AT command on your modem):

E1       command echo ON        
Q0       result codes are reported              
V1       verbose ON
S1=0     never answer (uugetty handles this with the WAITFOR option) 

If you don't set these correctly, your INIT string in your config file may fail, hosing the whole process. But, more on config files below...

&C1 DCD is on after connect only

If DCD is always on, getty will always think there is a connection, and may try to log people in.

Other things you should set:

&S0 DSR is always on
&D3 DTR on/off resets modem 
enable your data compression (setting depend on modem manufacturer, 
                              consult your modem manual)
autobaud                     (same applies here)
enabling RTS/CTS             (here too)

If your modem does not support a stored profile, you can set these through the INIT string in your config file. See below.

7.2 Example modem setup

Here is my modem setup, for a Telebit T1600. Most things should work for any Hayes compatible modem though. Don't worry if there are some things in my setup that aren't on yours.

T1600 - Version LA1.00  - Active Configuration
 B1  E1  L2  M0  P   Q0  V1  X12  Y0 
&C1 &D3 &G0 &J0 &L0 &Q0 &R3 &S1 &T4 &X0 
S000=0   S001=0   S002=43  S003=13  S004=10  S005=8   S006=2   S007=40 
S008=2   S009=6   S010=14  S011=70  S012=50  S018=0   S025=5   S026=1  
S038=0   S041=0   S045=0   S046=0   S047=4   S048=0   S050=0   S051:254
S056=17  S057=19  S058:2   S059=0   S060=0   S061:0   S062=15  S063=0  
S064:1   S068:3   S069=0   S090=0   S093=8   S094=1   S100=0   S102=0  
S104=0   S105=1   S111:30  S112=1   S180:3   S181=1   S183=25  S190=1  
S253=10  S254=255 S255=255 

7.3 Setting up uugetty

Replace the stock getty with getty_ps as described above. Update /etc/gettydefs to include entries for modems (note that the entries point to each other, these are not for fixed speed):

# Modem entries
38400# B38400 CS8 # B38400 SANE -ISTRIP HUPCL #@S @L @B login: #19200

19200# B19200 CS8 # B19200 SANE -ISTRIP HUPCL #@S @L @B login: #9600

9600# B9600 CS8 # B9600 SANE -ISTRIP HUPCL #@S @L @B login: #2400

2400# B2400 CS8 # B2400 SANE -ISTRIP HUPCL #@S @L @B login: #1200

1200# B1200 CS8 # B1200 SANE -ISTRIP HUPCL #@S @L @B login: #300

300# B300 CS8 # B300 SANE -ISTRIP HUPCL #@S @L @B login: #38400

If you have a 9600 bps or faster modem with flow control, you can lock your serial port speed and let the modem handle the translation to other bps rates. Then, instead of the step down series of lines listed below, /etc/gettydefs only needs to contain one line for the modem:

38400# B38400 CS8 # B38400 SANE -ISTRIP HUPCL #@S login: #38400

or

19200# B19200 CS8 # B19200 SANE -ISTRIP HUPCL #@S login: #19200

If you have your modem set up to do RTS/CTS hardware flow control, you can add CRTSCTS to the entries.

Next, make sure that you have a dialin and dialout device for the port and your modem is on. If you have your modem on ttyS3 you will need the /dev/cua1, and /dev/ttyS1 devices. If you don't have the correct devices, see the section on how to create devices, and create the devices.

7.4 Customizing uugetty

There are lots of parameters you can tweak for each port you have. These are implemented in seperate config files for each port, if you want. The file /etc/conf.uugetty will be used by all instances of uugetty, and /etc/conf.uugetty.ttySn will only be used by that one port. Sample default config files can be found with the getty_ps source files, which come with most Linux distributions. Due to space concerns, they are not listed here. My /etc/conf.uugetty.ttyS3 looks like this:

# sample uugetty configuration file for a Hayes compatible modem to allow
# incoming modem connections
#

# alternate lockfile to check... if this lockfile exists, then uugetty is
# restarted so that the modem is re-initialized
ALTLOCK=cua3
ALTLINE=cua3

# line to initialize
INITLINE=cua3

# timeout to disconnect if idle...
TIMEOUT=60

# modem initialization string... 
#
# format: <expect> <send> ... (chat sequence)
INIT="" \d+++\dAT\r OK\r\n ATH0\r OK\r\n AT\sE1\sQ0\sATS0=0\r OK\r\n

WAITFOR=RING
CONNECT="" ATA\r CONNECT\s\A

# this line sets the time to delay before sending the login banner
DELAY=1

#DEBUG=010

Add the following line to your /etc/inittab, so that uugetty is run on your serial port:

S3:456:respawn:/etc/uugetty ttyS3 38400
(^port without "tty"        ^port ^-- put your highest modem speed here)

Restart init:

linux# kill -HUP 1

Now Linux will be watching your serial port for connections. Notice that we use uugetty for modems. This is because it does things like checking lock files.

Dial in from another site and log in to you Linux system. Rejoice.

getty and uugetty have a lot more options, see the man page for getty(1m) for a full description. Among other things there is a scheduling feature, and a ringback feature. RTFM :-).

Next Chapter, Previous Chapter

Table of contents of this chapter, General table of contents

Top of the document, Beginning of this Chapter