[Войти] [Зарегистрироваться]

Наши друзья и партнеры

Беспроводные выключатели nooLite

Lines Club

Ищем достойных соперников.

Книги по Linux (с отзывами читателей)

Библиотека сайта или "Мой Linux Documentation Project"

Linux System Administrator's Survival Guide lsg13.htm

Previous Page TOC Next Page

Chapter 13


If you want to talk to the outside world (a friend's computer, another network, the Internet, or a BBS, for example), or you want to let others talk to your Linux system, you need a modem. Modems used to be expensive, complex pieces of equipment that required a considerable amount of UNIX expertise to install and configure properly. Now, using one of today's highest speed modems is as easy as plugging it in and modifying a file or two. This short chapter looks at the installation requirements for a modem.

Choosing a Modem

Linux works with just about any modem as long as it plugs into the system somehow and has a device driver. Choosing the modem then becomes a matter of using an existing modem on your PC or buying one specifically for Linux.

Modems are a competitive market. The fight between companies for the flashiest advertisements, most features, and best included software is leading to lower prices and better bargains. Most of the software included with modems is for DOS or Windows, you don't need to worry about any type of software for Linux. If you intend to run the modem on your DOS partitions, consider the software for that aspect only.

<NOTE>As a general rule, if a modem works with DOS, it will work under Linux. When you install the modem, specify the serial port name, and Linux can work with the modem. A modem can work equally well with both operating systems.<NOTE>

A common problem in choosing from today's modems is the plethora of acronyms, speeds, and features that are touted for different modems. Modem standards have gone crazy in the last few years, as better telephone circuits (including fiberoptics) and more efficient data compression algorithms have been developed. Compression algorithms are the current fad in the market. They use sophisticated mathematical systems to pack as much as five times as many bits per second along a line. For this reason, everyone seems to want data compression in modems, but most users don't realize that the compression scheme must be identical on both ends of the line, or the default speed is the best a modem can achieve.

The current state-of-the-art modems use V.FC (V.Fast Class, also known as V.34), which has a speed of 28,800bps. V.FC modems are usually used with data compression schemes to boost the effective throughput to speeds as high as 115kbps. V.FC was developed as a project between Hayes Microcomputer Products and Rockwell. Over 100 modem manufacturers have agreed to accept it as a working standard. The V.34 standard has now been officially adopted. The same situation does not apply to some of the compression algorithms≈they are de facto, not actual standards. This point is probably moot as the sheer weight of the companies behind these modem standards should carry them through to adoption.

To help you keep up with the different modem speeds in use today, the following table lists the communications speeds (in bits per seconds) and their names.

Base communication speeds
V.FC (V.Fast Class) 28,800bps
V.34 / V.Fast) 28,800bps
V.32terbo 19,200bps
V.32bis 14,400bps
V.32 9,600bps
V.22bis 2,400bps
212A 1,200bps
V.21 300bps
103 300bps
Data compression systems
V.42bis 4:1 compression to 115,200bps on a 28,800bps line
MNP5 2:1 compression algorithm used in older modems
Fax standards
V.17 14,400bps, 12,000bps, 9,600bps, and 7,200bps
V.29 9,600bps and 7,200bps
V.27ter 4,800bps and 2,400bps
V.21 Channel 2 300bps

A current trend in DOS and Windows systems is to use enhanced serial port devices, which are necessary to sustain the high baud rates that the modern fast modems can reach. Most of these devices are addressed as standard serial ports by the operating system, so they will work with Linux. Any accelerator device that requires a special driver, though, will not work unless you port the driver to Linux (not an easy task). Your standard serial ports should be at least 16550 UARTs (instead of the older 16450 UARTs) if you intend to run your modem at speeds higher than 9,600 baud. If you have an older PC, check with your dealer about upgrading the serial ports. The upgrade is usually very inexpensive and makes a major difference in modem performance with fast speeds.

<NOTE>The 16550 UART has a 16-byte buffer, but the 16450 has only a 1-byte buffer. In general, the 16450 UARTs can only be used to 9,600 baud. Any higher throughput speeds require 16550 UARTs.<NOTE>

Linux doesn't care whether your modem is an internal or external model, as long as it has a serial port designation that it can be addressed through. The choice between internal and external modem has become one-sided lately. Five years ago, the internal modem was the modem of choice. Most name-brand modems now are external, probably because of easier upgradability. Most manufacturers offer both types of modems. Note that internal modems save you a serial port on the back of the machine and almost always use a 16550 or faster UART.

One thing to consider with many new modem models is their software upgradability. Some modems allow you to load new versions of the controlling software through a DOS session. You obtain the new software through a bulletin board or on-line service. This capability reduces the obsolescence factor considerably. Most new modems adapt themselves automatically to any of the adopted modem standards (as well as fax standards, if you purchase a fax modem).

Installing a Modem

If the modem you purchase is an internal modem, you must open your machine and add it in an unused slot. Make sure you set the communication port parameters to an unused value. Most internal modems are set by default to use DOS COM3 or COM4. These values also work with Linux, as long as you can copy the serial port device driver to those values. The COM3 and COM4 settings can cause a problem with the PC architecture because COM3 shares the same IRQ with COM1 and COM4 shares the same IRQ with COM2. For this reason, try not to use both COM ports that share an IRQ at the same time. In other words, if you are using both COM2 and COM4 for modems at the same time, you are going to have problems.

External modems plug in to an unused serial port, either on the main PC backplane or on an expansion port board. Either way, the cabling has to be set for DCE (Data Communications Equipment) and use a modem cable (which has pins straight through it). For more information on cabling serial devices, see Chapter 11, "Terminals and term."

You can support more than one modem on a system because Linux treats them as devices and doesn't impose limits. If you have two serial ports, you can use two modems. If you have a 32-port multiport board attached to your system, you can use all of the ports for modems if you want. You set the limits. Bear in mind, however, that modems are usually dedicated as either call-in or call-out devices, not both (a holdover from a old UNIX convention), although Linux lets you switch modes easily.

Configuring a Modem

The easiest way to configure a modem to work with Linux is to use the setup or configuration utility that came with your Linux software system. In most cases, the setup utility asks you during the installation process whether you are using a modem, what port it is on, and what its maximum speed is to be set at. If you add a modem after installing Linux, you can access these routines by rerunning the setup or configuration program. Using one of these automated systems prevents you from having to modify files manually.

<NOTE>When you are assigning modems to a serial port, remember that Linux starts numbering at 0. DOS' COM1 is Linux's /dev/cua0; COM2 is /dev/cua1, and so on.<NOTE>

During the automated installation process, you are asked for the maximum speed of your modem. If the speed isn't represented on the list you see, choose the next fastest speed. For example, if your modem claims to be able to run at 28,800 bps and that speed isn't on the configuration menu, choose the next fastest, which is probably 38,400. The modem adjusts itself independent of Linux.

If you must configure the modem manually (either because you have no automated routine or you simply want to), you need a device driver for one of the available serial ports on your machine. Usually there are two device drivers for each serial port, one for calling out and the other for calling in (Linux can't handle both functions at the same time). The device drivers are differentiated by their major device numbers (minor device numbers are the same, usually set to 64 and up for serial port devices). Modems used for dialing in have a major device number set to four, and dial-out modems have the major device number set to five. The device drivers have different names, too. Dial-in modems have device names like ttyS0, ttyS1, and so on. Dial-out modems have device names like cua0, cua1, and so on.

Check to see whether there are device drivers for your serial ports by listing the /dev/ttyS* files for dial-in drivers and /dev/cua* files for dial-out drivers. The listings should show the device numbers in the fifth and sixth columns. The numbers should correspond to those shown in the following list:

      COM1 dial-in (/dev/ttyS0): major 4, minor 64

      COM2 dial-in (/dev/ttyS1): major 4, minor 65

      COM3 dial-in (/dev/ttyS2): major 4, minor 66

      COM4 dial-in (/dev/ttyS3): major 4, minor 67

      COM1 dial-out (/dev/cua0): major 5, minor 64

      COM2 dial-out (/dev/cua1): major 5, minor 65

      COM3 dial-out (/dev/cua2): major 5, minor 66

      COM4 dial-out (/dev/cua3): major 5, minor 67

If the devices have different numbers, you can use whatever they are set at or delete them and recreate the devices. If the devices work as they are set, don't bother changing them unless conflicts arise with other devices. If you have to create (or recreate) a device driver for the serial ports, use the following command as a example:

mknod -m 666 /dev/cua1 c 55 65

This command creates the dial-out serial port device driver for COM2 (/dev/cua1) with major number 5 and minor number 65, sets it as a character mode device (which asynchronous modems have to be set as), and sets the file permissions to mode 666. (For more information on the mknod command, see Chapter 6, "Devices and Device Drivers." For more information on file permissions, see Chapter 17, "System Names and Access Permissions.")

Many Linux systems use a symbolic link from the active dial-out device driver to a new device called /dev/modem. Using this link makes configuration a little easier, especially if you change the active dial-out port regularly, because you simply have to relink the /dev/modem device file instead of modifying many applications. To set up the link, issue the command

ln /dev/cua1 /dev/modem

If you do use a link to /dev/modem, make sure that you use that device file in all the applications that will use the serial port; otherwise, the device locking process will not work correctly. The preceding examples use the COM2 port; change the device name as required (along with the major and minor numbers, as necessary).

Finally, invoke handshaking protocols for any port used by a modem. This task is easy to do, although most applications and user guides fail to mention it. To turn on handshaking, issue the command

stty crtscts < /dev/cua1

Replace the device name with the proper modem device (or use /dev/modem if you set up the link). You can check the status of the handshaking flag at any time with the command

stty -a /dev/cua1

which shows a list of all flags. If the crtscts flag has a minus sign in front of it, handshaking is turned off, and you should turn it on.

Once the modem is installed, you can use any communications program (kermit, UUCP, cu, and so on) to test it. Make sure you specify the dial-out modem line properly. These programs are usually not used for dial-in modems, which are mostly set to allow standard logins.

Setting Fast Modem Speeds

Serial ports are usually limited by Linux to 38,400 baud. (When you ran setup, you were asked for the maximum baud rate the modem port could support, and the largest number on the list was 38,400.) In order to run faster modems, you must use the setserial command. The setserial command enables you to set a 38,400 baud port to run at 57,600 baud with the following command:

setserial /dev/cua2 spd_hi

Replaced /dev/cua2 with the name of the modem device you are configuring for high speed. (You can also use the /dev/modem device name if you linked it earlier to the modem device driver.)

To run your modem at 115,200 baud, use the spd_vhi option:

setserial /dev/modem spd_vhi

Both the spd_hi and spd_vhi options can be specified by a non-root user, so regular Linux system users can tailor a modem port when they want to change speeds. You can return the modem port to the normal 38,400 baud rate with the following command:

setserial /dev/modem spd_normal

The setserial commands work with Linux kernels of version 1.0 and higher. The command is enhanced considerably with each later version, so check the man page to see what options are available for customizing serial ports with your Linux release.


Installing a high-speed modem (or even an older, slower model) is easy with Linux, as long as you have a device driver properly set up. Dozens of applications work under Linux to offer everything from terminal emulation to complex communications protocols. Most modem use is for dialing out, although you may want to configure a modem for friends to log in to your system.

Previous Page Page Top TOC Next Page

Эта статья еще не оценивалась
Вы сможете оценить статью и оставить комментарий, если войдете или зарегистрируетесь.
Только зарегистрированные пользователи могут оценивать и комментировать статьи.

Комментарии отсутствуют