Debian Linux Modem Configuration
The material on this page was prepared using Sarge or Etch
configured using our Installation and Packages pages.
If you did not use our pages to set up your system, what you
encounter on your system may be different than what is given here.
This page covers how to configure dial-up modems. See the Web HOWTO documents for cable or DSL modems. A comparison of cable and DSL broadband services is presented on the Networking page.
First and foremost, make sure your modem is not a "winmodem" (a stripped-down modem that's controlled through a Windows software driver). Second, if at all possible get yourself an external modem. An external non-winmodem modem presents a lot less headaches trying to set up and having the indicator lights to look at during proxy/firewall testing and console FTP (when there is no file transfer progress indicator) is a real benefit. Internal modems basically have three problems. They either; are winmodems, are likely going to be PCI bus modems (and 99% of PCI bus modems are Winmodems), or they have to be set up via software - software which is usually only available for Windows.
Also, if you're going to use an external modem, go into your system BIOS' peripheral settings and take the serial port you've connected the modem (connect the modem before doing this) to out of AUTO mode so that it explicitly uses 3F8h/IRQ4 or and 2F8h/IRQ3.
Note: If your system won't be connected to a network that has Internet access you'll want to spend a little extra to get a good modem. Once you get your system set up using the CDs you'll rely on the modem to update your system. With so many people going to broadband services at home, you can usually pick up an external USR Sportster 56K non-winmodem on eBay for around $35.Because internal modems also represent an additional serial port, you have to be careful in setting the modem up. If you have an internal modem that you want to try and use, see if it has jumpers on it that will allow you to set the I/O port and IRQ settings. If it doesn't, and it only comes with Windows configuration software, you'll have to temporarily install the modem into a Windows sytsem and use the software to set the I/O port and IRQ values. In addition, ISA-bus internal modems are better for use with Linux than PCI modems. If money is tight, try finding an internal 56K ISA modem that has jumpers (so you can manually set the port and IRQ) on eBay. Again, make certain it's not a winmodem.
The Physical Connection
Newer ystems will come with either one or two serial ports which are built into the motherboard. These are typically 9-pin male connectors on the back of the PC. You can simply connect an external modem to one of these. If you add an internal modem to the system it has to be set up as the next serial port (for example number 3 in a system that has two of them built in). Or, if you system BIOS allows it, you could disable the second serial port and set the modem up to take its place. The following table will help you set the jumpers or software configuration on an internal modem card.
Serial Port DOS Linux I/O Port IRQ First COM1 /dev/ttyS0 03F8 4 Second COM2 /dev/ttyS1 02F8 3 Third COM3 /dev/ttyS2 03E8 4 Fourth COM4 /dev/ttyS3 02E8 3
Be careful when specifying the serial ports in Linux/UNIX commands. As you can see from the above table, the Linux ttyS number is one less than the DOS COM number because Linux starts at 0 while DOS starts at 1. If you've had some experience with DOS, typing in ttys0 when you mean the COM1 can take some getting used to.
If you're stuck with an internal modem with no jumpers, or you have problems with an internal modem, try reading through the Modem HOWTO.
Once you've got your modem connected and powered up a simple command will let you know if the system can communicate with it. For a modem connected to the second serial port, simply type in:
echo atdt3333333 > /dev/ttyS1
You should hear some clicking noises from the modem. If it's an external modem you can also look for lights flashing.
If the modem actually dials the '3333333' number you'll quickly want to follow that command with this one:
echo ath > /dev/ttyS1
to hang the modem up.
If the above test didn't work on a desktop system, don't proceed. You've got some troubleshooting to do. Don't overlook the obvious things, like the modem's speaker volume being turned down (you could try listening for the dialing attempt on an extension phone) or you simply used the wrong number for the ttyS part of the command.
For serial ports that are integrated into the motherboard one thing you can try is going into your system's BIOS and hard-setting the values (as given in the above chart) rather than using any "Auto" or
"OS configurable"settings. You can also see what the OS thinks the ports are set to using the setserial for the appropriate port. For example, for the second serial port you would use:
This command does not indicate what the actual port settings are. It merely shows what the OS is going to use to access that port so your hardware port settings, whether set with jumpers or in the BIOS, have to match what this command displays.
The above echo command didn't work when I tried it on my notebook with a 3Com PCMCIA modem. However, it still dialed out and connected fine once I got everything configured as detailed in the next section. The PCMCIA HowTo document covers several useful utilities you can use when working with PCMCIA devices under Linux.
The Logical Connection
Now that your modem is physcially connected properly it's time to set up a connection to your ISP. Be sure you are logged in as root before proceeding.
There are actually two parts to setting up a connection to your ISP. You have to configure the dialer (the chat program), and the PPP (Point-to-Point Protocol) settings (the pppd daemon). PPP is the protocol that modems use to communicate over a serial link. (PPP is a powerful protocol that is also often used when connecting distant routers over dedicated leased lines.)
Knowing the version of the pppd daemon you're using can sometimes be useful. While pppd doesn't have a command-line parameter to show the version, using the -v parameter does work because it's seen as an invalid parameter and, as such, causes the help screen to appear. The version number is at the top of this information. So to see your pppd version, simply use the command:
To configure chat we have to edit the /etc/chatscripts/provider file. Initially, the file looks like this:
You can edit this file by entering the following two commands:ABORT BUSY ABORT "NO CARRIER" ABORT VOICE ABORT "NO DIALTONE" "" ATDT<put phone number here> ogin <put your login name here> word \q<put your password here>
Once you edit the file it should look something like this:cd /etc/chatscripts
Press Ctrl-X and then 'y' when prompted to save the changes (and Enter when the file name is displayed).ABORT BUSY ABORT "NO CARRIER" ABORT VOICE ABORT "NO DIALTONE" "" ATDT5551212 ogin bgates word \qluvlinux
Once you've edited and saved the file it's time to configure ppp. Oddly enough, this configuration file has the same name as the dialer configuration file. It's just located in a different place.
/etc/ppp/peers/provider is the ppp configuration file. You edit it by typing in:
There are only two things you need to change in this file:cd /etc/ppp/peers
- Look for the default modem line which has /dev/modem and change it to the correct ttyS entry for your modem's serial port (ex: /dev/ttyS1 for the second serial port)
- Look for the speed line which has 38400 and change it to 115200
The speed setting of 115200 may be too high only if you have a 486 computer that doesn't have a 16550 UART chip. If you're using a 486 and not sure of the UART, play it safe and set the speed to 56700 instead. Exit the nano editor saving the file.
There's only one more file that we need to edit and it's not really related to ppp or the dialer. It's a TCP/IP configuration file. The /etc/resolv.conf file is where you enter your DNS server information. If you're going to be connecting to the Interent you need to be able to resolve domain names (we talk more about this on the
You'll need to use your ISP's DNS server settings, the same way you enter them if you set up a Dialup Networking connection in Windows. If you don't remember these settings your ISP likely lists them on one of their technical support Web pages. Edit the resolv.conf file by entering:
and edit the file entering the two IP addresses of your ISP's DNS servers so it looks like this:cd /etc
It's likely that the domain name on the search line is the one you entered during the installation. Be sure to change it to your ISP's domain name. Once you save this file and exit the editor you're ready to roll.search yourisp.com
Above we said that the pppd daemon is responsible for setting up the connection. We don't run the daemon directly. Instead we use a couple shell scripts that have been created to set up the connection and to take it down when we're done. These two shell scripts are called pon and poff
Because you changed several configuration files it would be easier to simply reboot the system rather than restart the associated services. Once it comes back up and you're logged in, simply enter:
at the shell prompt to dial and connect to your ISP. If you have an external modem you can watch the lights to see if you get a connect. Once you're connected, see if you can ping one of the DNS servers that you entered in the above resolv.conf file. For example, if the address of one of the DNS servers is 172.18.180.99 you would enter:
You should get responses back. Press Ctrl-C to stop the responses.
You can also check to make sure your DNS resolution is working correctly by trying to ping using a domain name.
You should get responses back here also. If you can ping an IP address but not a domain name there's something is wrong in your resolv.conf file.
Note: You may not receive ping responses if you have already configured a network card on your system. This is because the system is using the default gateway setting for your ethernet NIC (if you entered an IP address for one during the install) and not the ppp0 interface that the modem sets up. You can check this out with the command:
Look for the default line. Look at the far right column and see if eth0 is listed as the "Iface" for this line. If it is, your system is sending all your Internet-destined traffic out of the NIC (a dead end). Try typing in the following command at the shell prompt:
route add default ppp0
Now try pinging your ISP's DNS server address. You should be able to now because your system is routing traffic out of the modem. You can verify this by looking at the system's routing table again by again entering route by itself at the shell prompt. You should see a second default line with ppp0 listed in the right-most column.
The above behavior is normal. Think about it. If you have a network-connected system but you need to access the Internet via a modem, your network obviously doesn't have a gateway to the Internet. In this case, you shouldn't have a default gateway setting in your NIC configuration. We get more into default gateways and the ping command on the Networking page.
Have you ever surfed the Web using a text-based Web browser? Try it out! At the shell prompt type in:
apt-get install lynx
and press Enter. Once it's installed type in lynx at the shell prompt to start it. Then use the following keys to try it out:
- use the up and down arrow keys to move from one link to another and look at the text on the current page
- use the right arrow key to "follow" a link
- use the left arrow key to return to the previous page
- hit the g key to enter a URL to go to a different site
- hit the q key to quit lynx
Have you ever wondered why those HOWTO pages all have the same bland format? It's so they display in a readable format when viewed with text-based browsers. Try looking at one of the HOWTOs in Lynx by press g and then typing in the following URL (note that it, like Linux/UNIX, is case-sensitive):
As you can see, you don't need a GUI to get Web-based help with your Linux questions.
You can now also try starting up the GUI with the startx command and firing up the Mozilla browser we installed on the Packages page.
When you're done using the Internet connection be sure to disconnect from your ISP by typing in:
at the shell prompt.
Testing Your Server
If you've got two phone lines you can use your new dial-up connection to use one phone line to connect your Debian system to your ISP and the other to call a friend or family member in a different part of the country (who also has two phone lines) and walk them through trying out the server capabilities of your Debian system. If you or they don't have two phone lines you could just make sure you're both on line at the same time and e-mail the IP address of your Debian system to them.
The Web Server
If you installed the Apache Web server package as illustrated on our Packages page, you can ask your friend or family member in a different part of the country (or a different part of the world for that matter) to try and access your Web server.
If you're not already connected to the Internet, use the pon command to connect your Debian system to your ISP. Once connected, at the shell prompt type in:
If you've got a network card installed and configured you'll see three "interfaces" listed, the loopback, eth0, and one for ppp0 which is your dial-up connection. If you don't have a NIC you'll just see the loopback and ppp0 entries. Look at the IP address next to "inet addr:" in the ppp0 entry. That's the IP address your ISP assigned to your Debian system for this call. This is what you want your friend or family member to type into their browser. For example, if the IP address assigned for the ppp0 interface is 172.17.59.132, then tell or e-mail your friend or family member to type the following into the location/address bar in their Web browser:
They should see the same Apache/Debian Web page you may have seen if you tried this back on the Packages page. The difference is they are accessing your system and pulling the page over the Internet where as you were accessing the system and pulling the page over your local network.
How About Telnet ?
The Debian 2.2 install routine enables telnet access by default. (For Woody and Sarge we added the telnet package back on the Installation page.) If your friend or family member is fairly computer-literate you can also have them try and telnet into your system over the Internet. You'll need to create an account for them but that's easy enough. The command:
useradd dad -p october
creates an account with a login name of dad and dad's password is october.
We're assuming your friend or family member uses a Windows PC to connect to the Internet. Tell or e-mail them to click on the "Start" button and select "Run" and then in the command input field they just type in:Note: For security reasons, you cannot telnet or ftp into a server using the root superuser ID. You'll want to use the non-root account you created during the Debian installation. In the case of telent, once you log in using your non-root account you can use the su command to log in as root. You'll then have to type in exit twice when you are finished. Once to exit out of the root login, and then one more time to close the telnet session.
(or whatever the IP address of your Linux system's ppp0 interface is) and press Enter.
Once connected they should get a login prompt. This is where they enter the ID and password you set up with the above useradd command. Once they log in they should get a shell prompt with a $ at the end. They can then type in different Linux commands as if they were sitting at the console.
You could tell them to disconnect gracefully by typing in exit at the shell prompt but that's no fun. You can see which process they came in as by entering the following command:
You'll see an entry for in.telnetd and all the way over on the left side of this line you'll see a PID (Process ID number). It'll be something like 716 or some other number. (If you don't have two phone lines and you're waiting for the person to try and telnet in at your pre-arranged time, you can just press the Up Arrow key and Enter repeatedly to run the ps command to watch for their connection.)
Once you know their PID, you can disconnect them by killing their process. Just type in:
(or whatever their PID is) to kill their telnet process which will disconnect them.
Again, be sure to use the poff command when you're finished testing.
There's no reason you can't have a modem connection to the Internet and a network connection to a LAN both going at the same time. As a matter of fact, with such a dual-connected configuration you could set your Debian system up to be a proxy server where it would act as the default gateway for your LAN. We'll cover the basics of that on the Networking page and show you how to set one up on the Proxy/NAT page.
Did you find this page helpful ?
If so, please help keep this site operating
by using our DVD or book pages.
Site, content, documents, original images Copyright © 2003-2013 Keith Parkansky All rights reserved
Duplication of any portion of this site or the material contained herein without
the express written consent of Keith Parkansky, USA is strictly prohibited.
This site is in no way affiliated with the Debian Project, the debian.org Web site, or
Software In The Public Interest, Inc. No endorsement of this site by the Debian Project
or Software In the Public Interest is expressed or implied. Debian and the Debian logo
are registered trademarks of Software In The Public Interest, Inc. Linux is a registered
trademark of Linus Torvalds. The Tux penguin graphic is the creation of Larry Ewing.
IN NO EVENT WILL KEITH PARKANSKY OR BLUEHOST INCORPORATED OR ANY OF ITS' SUBSIDIARIES BE LIABLE TO ANY PARTY (i) FOR ANY DIRECT, INDIRECT, SPECIAL, PUNITIVE OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF PROGRAMS OR INFORMATION, AND THE LIKE), OR ANY OTHER DAMAGES ARISING IN ANY WAY OUT OF THE AVAILABILITY, USE, RELIANCE ON, OR INABILITY TO USE THE INFORMATION, METHODS, HTML OR COMPUTER CODE, OR "KNOWLEDGE" PROVIDED ON OR THROUGH THIS WEBSITE, COMMONLY REFERRED TO AS THE "ABOUT DEBIAN" WEBSITE, OR ANY OF ITS' ASSOCIATED DOCUMENTS, DIAGRAMS, IMAGES, REPRODUCTIONS, COMPUTER EXECUTED CODE, OR ELECTRONICALLY STORED OR TRANSMITTED FILES OR GENERATED COMMUNICATIONS OR DATA EVEN IF KEITH PARKANSKY OR BLUEHOST INCORPORATED OR ANY OF ITS' SUBSIDIARIES SHALL HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, AND REGARDLESS OF THE FORM OF ACTION, WHETHER IN CONTRACT, TORT, OR OTHERWISE; OR (ii) FOR ANY CLAIM ATTRIBUTABLE TO ERRORS, OMISSIONS, OR OTHER INACCURACIES IN, OR DESTRUCTIVE PROPERTIES OF ANY INFORMATION, METHODS, HTML OR COMPUTER CODE, OR "KNOWLEDGE" PROVIDED ON OR THROUGH THIS WEBSITE, COMMONLY REFERRED TO AS THE "ABOUT DEBIAN" WEBSITE, OR ANY OF ITS' ASSOCIATED DOCUMENTS, DIAGRAMS, IMAGES, REPRODUCTIONS, COMPUTER EXECUTED CODE, OR ELECTRONICALLY STORED, TRANSMITTED, OR GENERATED FILES, COMMUNICATIONS, OR DATA. ALL INFORMATION, METHODS, HTML OR COMPUTER CODE IS PROVIDED STRICTLY "AS IS" WITH NO GUARANTY OF ACCURACY AND/OR COMPLETENESS. USE OF THIS SITE CONSTITUTES ACCEPTANCE OF ALL STATED TERMS AND CONDITIONS.