[an error occurred while processing this directive] FreeBSD Handbook : Basic Networking : Dialup access : Configuration Files
Previous: Device Special Files
Next: Modem Settings

10.4.5. Configuration Files

There are three system configuration files in the /etc directory that you'll probably need to edit to allow dialup access to your FreeBSD system. The first, /etc/gettytab, contains configuration information for the /usr/libexec/getty daemon. Second, /etc/ttys holds information that tells /sbin/init what tty devices should have getty processes running on them. Lastly, you can place port initialization commands in the /etc/rc.serial script if you have FreeBSD 1.1.5.1 or higher; otherwise, you can initialize ports in the /etc/rc.local script.

There are two schools of thought regarding dialup modems on UNIX. One group likes to configure their modems and system so that no matter at what speed a remote user dials in, the local computer-to-modem RS-232 interface runs at a locked speed. The benefit of this configuration is that the remote user always sees a system login prompt immediately. The downside is that the system doesn't know what a user's true data rate is, so full-screen programs like Emacs won't adjust their screen-painting methods to make their response better for slower connections.

The other school configures their modems' RS-232 interface to vary its speed based on the remote user's connection speed. For example, V.32bis (14.4 Kbps) connections to the modem might make the modem run its RS-232 interface at 19.2 Kbps, while 2400 bps connections make the modem's RS-232 interface run at 2400 bps. Because getty doesn't understand any particular modem's connection speed reporting, getty gives a login: message at an initial speed and watches the characters that come back in response. If the user sees junk, it's assumed that they know they should press the <Enter> key until they see a recognizable prompt. If the data rates don't match, getty sees anything the user types as ``junk'', tries going to the next speed and gives the login: prompt again. This procedure can continue ad nauseum, but normally only takes a keystroke or two before the user sees a good prompt. Obviously, this login sequence doesn't look as clean as the former ``locked-speed'' method, but a user on a low-speed connection should receive better interactive response from full-screen programs.

The author will try to give balanced configuration information, but is biased towards having the modem's data rate follow the connection rate.

10.4.5.1. /etc/gettytab

/etc/gettytab is a termcap(5)-style file of configuration information for getty(8). Please see the gettytab(4) manual page for complete information on the format of the file and the list of capabilities.

Locked-Speed Config

If you are locking your modem's data communications rate at a particular speed, you probably won't need to make any changes to /etc/gettytab.

Matching-Speed Config

You'll need to setup an entry in /etc/gettytab to give getty information about the speeds you wish to use for your modem. If you have a 2400 bps modem, you can probably use the existing D2400 entry. This entry already exists in the FreeBSD 1.1.5.1 gettytab file, so you don't need to add it unless it is missing under your version of FreeBSD:

#
# Fast dialup terminals, 2400/1200/300 rotary (can start either way)
#
D2400|d2400|Fast-Dial-2400:\
        :nx=D1200:tc=2400-baud:
3|D1200|Fast-Dial-1200:\
        :nx=D300:tc=1200-baud:
5|D300|Fast-Dial-300:\
        :nx=D2400:tc=300-baud:

If you have a higher speed modem, you'll probably need to add an entry in /etc/gettytab; here's an entry you could use for a 14.4 Kbps modem with a top interface speed of 19.2 Kpbs:

#
# Additions for a V.32bis Modem
#
um|V300|High Speed Modem at 300,8-bit:\
        :nx=V19200:tc=std.300:
un|V1200|High Speed Modem at 1200,8-bit:\
        :nx=V300:tc=std.1200:
uo|V2400|High Speed Modem at 2400,8-bit:\
        :nx=V1200:tc=std.2400:
up|V9600|High Speed Modem at 9600,8-bit:\
        :nx=V2400:tc=std.9600:
uq|V19200|High Speed Modem at 19200,8-bit:\
        :nx=V9600:tc=std.19200:

On FreeBSD 1.1.5 and later, this will result in 8-bit, no parity connections. Under FreeBSD 1.1, add :np: parameters to the std.xxx entries at the top of the file for 8 bits, no parity; otherwise, the default is 7 bits, even parity.

The example above starts the communications rate at 19.2 Kbps (for a V.32bis connection), then cycles through 9600 bps (for V.32), 2400 bps, 1200 bps, 300 bps, and back to 19.2 Kbps. Communcations rate cycling is implemented with the nx= (next table) capability. Each of the lines uses a tc= (table continuation) entry to pick up the rest of the ``standard'' settings for a particular data rate.

If you have a 28.8 Kbps modem and/or you want to take advantage of compression on a 14.4 Kbps modem, you need to use a higher communications rate than 19.2 Kbps. Here's an example of a gettytab entry starting a 57.6 Kpbs:

#
# Additions for a V.32bis or V.34 Modem
# Starting at 57.6 Kpbs
#
vm|VH300|Very High Speed Modem at 300,8-bit:\
        :nx=VH57600:tc=std.300:
vn|VH1200|Very High Speed Modem at 1200,8-bit:\
        :nx=VH300:tc=std.1200:
vo|VH2400|Very High Speed Modem at 2400,8-bit:\
        :nx=VH1200:tc=std.2400:
vp|VH9600|Very High Speed Modem at 9600,8-bit:\
        :nx=VH2400:tc=std.9600:
vq|VH57600|Very High Speed Modem at 57600,8-bit:\
        :nx=VH9600:tc=std.57600:

If you have a slow CPU or a heavily loaded system and you don't have 16550A-based serial ports, you may receive sio ``silo'' errors at 57.6 Kbps.

10.4.5.2. /etc/ttys

/etc/ttys is the list of ttys for init to monitor. /etc/ttys also provides security information to login (user root may only login on ttys marked secure). See the manual page for ttys(5) for more information.

You'll need to either modify existing lines in /etc/ttys or add new lines to make init run getty processes automatically on your new dialup ports. The general format of the line will be the same, whether you are using a locked-speed or matching-speed configuration:

ttyd0   "/usr/libexec/getty xxx"   dialup on

The first item in the above line is the device special file for this entry - ttyd0 means /dev/ttyd0 is the file that this getty will be watching. The second item, "/usr/libexec/getty xxx" (xxx will be replaced by the initial gettytab capability) is the process init will run on the device. The third item, dialup, is the default terminal type. The fourth parameter, on, indicates to init that the line is operational. There can be a fifth parameter, secure, but it should only be used for terminals which are physically secure (such as the system console).

The default terminal type (dialup in the example above) may depend on local preferences. dialup is the traditional default terminal type on dialup lines so that users may customize their login scripts to notice when the terminal is dialup and automatically adjust their terminal type. However, the author finds it easier at his site to specify vt102 as the default terminal type, since the users just use VT102 emulation on their remote systems.

After you have made changes to /etc/ttys, you may send the init process a HUP signal to re-read the file. You can use the command

kill -1 1

to send the signal. If this is your first time setting up the system, though, you may want to wait until your modem(s) are properly configured and connected before signalling init.

Locked-Speed Config

For a locked-speed configuration, your ttys entry needs to have a fixed-speed entry provided to getty. For a modem whose port speed is locked at 19.2 Kbps, the ttys entry might look like this:

ttyd0   "/usr/libexec/getty std.19200"   dialup on

If your modem is locked at a different data rate, substitute the appropriate name for the std.speed entry for std.19200 from /etc/gettytab for your modem's data rate.

Matching-Speed Config

In a matching-speed configuration, your ttys entry needs to reference the appropriate beginning ``auto-baud'' (sic) entry in /etc/gettytab. For example, if you added the above suggested entry for a matching-speed modem that starts at 19.2 Kbps (the gettytab entry containing the V19200 starting point), your ttys entry might look like this:

ttyd0   "/usr/libexec/getty V19200"   dialup on

10.4.5.3. /etc/rc.serial or /etc/rc.local

High-speed modems, like V.32, V.32bis, and V.34 modems, need to use hardware (RTS/CTS) flow control. You can add stty commands to /etc/rc.serial on FreeBSD 1.1.5.1 and up, or /etc/rc.local on FreeBSD 1.1, to set the hardware flow control flag in the FreeBSD kernel for the modem ports.

For example, on a sample FreeBSD 1.1.5.1 system, /etc/rc.serial reads:

#!/bin/sh
#
# Serial port initial configuration

stty -f /dev/ttyid1 crtscts
stty -f /dev/cuai01 crtscts

which sets the termios flag crtscts on serial port #1's (COM2:) dialin and dialout initialization devices.

On an old FreeBSD 1.1 system, these entries were added to /etc/rc.local to set the crtscts flag on the devices:

# Set serial ports to use RTS/CTS flow control
stty -f /dev/ttyd0 crtscts
stty -f /dev/ttyd1 crtscts
stty -f /dev/ttyd2 crtscts
stty -f /dev/ttyd3 crtscts

Since there isn't an initialization device special file on FreeBSD 1.1, one has to just set the flags on the sole device special file and hope the flags aren't cleared by a miscreant.


FreeBSD Handbook : Basic Networking : Dialup access : Configuration Files
Previous: Device Special Files
Next: Modem Settings [an error occurred while processing this directive]