The Haus

Plug and Play Modems in Linux

February 6, 2000 -- by A.T. Hun

Please Note! I did this in Red Hat 6.0 and 6.1. It should work very similarly on other variants of Linux. As always, make sure you backup your files before editing them! When I say to type a command, you obviously need to hit enter to execute it--but you knew that already, didn't you :)

Setting up a modem is not hard in Linux, but you have to jump through a few extra hoops if you want to configure a plug-and-play (PnP) modem. This is because the card's resources are either assigned by the BIOS or by the operating system. Most people say it is best to let the BIOS set the resources and let the OS deal with it. That is the way my system is set up.

Please note! By "plug-and-play" I do NOT mean Winmodems. If you have a Winmodem you cannot use it under Linux unless your modem manufacturer would make a utility to make that possible. Right now, I don't know of any companies that do. So if you have a Winmodem, you are most likely out of luck.

First a bit of information on how Linux deals with COM ports. The ports are viewed as files under /dev. Here is a conversion table to help you:

The easiest way to get the information about your modem is to get the information from Windows 95/98 if you have it installed already. If you do, you can get the COM port and IRQ by going to the Control Panel and clicking on the Modem icon. Click on the "Diagnosics" tab, select your modem, and hit the "More Info" button. Copy this information down.

Otherwise, you may need to do a bit of detective work. If your BIOS sets up the modem, it will most likely display at least what IRQ the modem is running on, if not the COM port too. Copy this information down.

Another way to get the COM port is to watch Linux as it is booting (or type dmesg after the boot to see what Linux displayed during the boot). If you know you have two serial ports on your motherboard, those will be /dev/ttyS0 and /dev/ttyS1. If Linux finds another port, either /dev/ttyS2 or /dev/ttyS3, you know that's the port your modem is on.

Once you've determined what your modem's port and IRQ are, you can configure Linux to use the modem. Log in as root. First you need to create a symbolic link between your port and /dev/modem. You can do this in one of two ways. You can either load up X, launch an xterm, and type modemtool. Choose the port your modem is on and you're all set. Otherwise from the console you can type ln -s /dev/ttySx /dev/modem (make sure to replace the x with the proper number of your port).

The ports use specific IRQs by default. Here's a listing:

If your modem is using the default IRQ, Linux can use your modem as-is. If it isn't, you'll need to run another command. At the console type setserial /dev/ttySx irq y (replace the x with the number of your port and y with the IRQ). In my case, my modem is on COM4 and it is IRQ 7, so I typed the command setserial /dev/ttyS3 irq 7.

The setserial command will not be remembered after you reboot. To make sure your irq is set properly everytime you boot, type cd /etc/rc.d. Fire up your favorite text editor, and edit the rc.local file. Add your setserial command on a line before the "fi" statement. It will automatically be set every time you boot. Please note: J.t.Qbe pointed out to me that this paragraph is specific to Red Hat and its offspring. Check your Linux distribution's documentation for information on running commands at boot-up time.