Setting up DIAL-UP Modem in Ubuntu Linux

Posted on 9:44 PM by Bharathvn

Although high-speed DSL, cable modem, and wireless LAN hardware have become
widely available, there may still be times when a phone line and a modem are your
only way to get on the Internet. Linux offers both graphical and command line tools
for configuring and communicating with modems.

As with other network connections in Ubuntu, dial-up modem connections can be configured using the Network Configuration window. Most external serial modems will
work with Linux without any special configuration. Most hardware PCI modems will
also work. However, many software modems (also sometimes called Winmodems)
often will not work in Linux (although some can be configured with special drivers,
and are therefore referred to as Linmodems).

Instead of describing the contortions you must go through to get some Winmodems
working in Linux, we recommend that you purchase either a modem that connects
to an external serial port or a hardware modem. If you want to try configuring your
Winmodem yourself, refer to the Linmodems site ( you are not able to get your modem working from the Network Configuration window, there are some commands you can try. First try the wvdialconf command to try to scan any modems connected to your serial ports and create a configuration file:

$ sudo wvdialconf /etc/wvdial.conf Scan serial ports, create config file Scanning your serial ports for a modem.

ttyS0: ATQ0 V1 E1 -- OK
ttyS0: ATQ0 V1 E1 Z -- OK

In this example, a modem was found on the COM1 port (serial port /dev/ttyS0).
Further output should show which speeds are available and various features that are
supported. The configuration information that results is, in this case, written to the file /etc/wvdial.conf. Here’s an example of what that file might look like:

[Dialer Defaults]
Modem = /dev/ttyS0
Baud = 115200
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 S11=55 +FCLASS=0
;Phone =
;Username =
;Password =

Open wvdial.conf in a text editor and remove the comment characters (;) from in
front of the Phone, Username, and Password entries. Then add the phone number you need to dial to reach your ISP’s bank of dial-in modems. Next add the user name
and password you need to log in to that modem connection.

To use the dial-up entry you just configured, you can use the wvdial command:

$ sudo wvdial Dial out and connect to your ISP
--> WvDial: Internet dialer version 1.54.0
--> Initializing modem.
--> Sending: ATZ
--> Modem initialized.

After the connection is established between the two modems, a Point-to-Point Protocol
(PPP) connection is created between the two points. After that, you should be able to
start communicating over the Internet. If you find that you are not able to communicate with your modem, there are some ways of querying your computer’s serial ports to find out what is going wrong. The first thing to check at the low level is that your /dev/ttyS? device talks to the hardware serial port.

By default, the Linux system knows of four serial ports: COM1 (/dev/ttyS0),
COM2 (/dev/ttyS1), COM3 (/dev/ttyS2), and COM4 (/dev/ttyS3). To see a
listing of those serial ports, use the setserial command (from the setserial package)
with the -g option, as follows:

$ setserial -g /dev/ttyS0 /dev/ttyS1 /dev/ttyS2 /dev/ttyS3 See port info
/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4
/dev/ttyS1, UART: unknown, Port: 0x02f8, IRQ: 3
/dev/ttyS2, UART: unknown, Port: 0x03e8, IRQ: 4
/dev/ttyS3, UART: unknown, Port: 0x02e8, IRQ: 3

To see more detailed information on your serial ports, use the -a option:

$ setserial -a /dev/ttyS0 View serial port details
/dev/ttyS0, Line 0, UART: 16550A, Port: 0x03f8, IRQ: 4
Baud_base: 115200, close_delay: 50, divisor: 0
closing_wait: 3000
Flags: spd_normal skip_test

$ setserial -ga /dev/ttyS0 /dev/ttyS1 Check multiple port details

The setserial command can also be used to re-map physical serial ports to logical
/dev/ttyS? devices. Unless you’re running kernel 2.2 with a jumper-configured ISA
serial card, you won’t need this. Modern Linux systems running on modern hardware
make COM1 and COM2 serial ports work right out of the box, so we won’t cover these
options. The stty command is another command you can use to work with serial ports. To view the current settings for the COM1 port (ttyS0), type the following:

$ stty -F /dev/ttyS0 -a View tty settings for serial port
speed 9600 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = ; eol2 =
; swtch = ; start = ^Q; stop = ^S;
susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff –
iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke

The dialer will typically change these settings as needed, although you can use the
stty command to change these settings as well. Refer to the stty man page (man
stty) for descriptions of any of the tty settings. You can talk directly to the modem or other serial devices using the minicom command (from the minicom package). In fact, it can be useful to troubleshoot dialing by issuing AT commands to the modem using minicom. The first time you run minicom, use -s to enter setup mode:

$ minicom -s Create your modem settings
| Filenames and paths |
| File transfer protocols |
| Serial port setup |
| Modem and dialing |
| Screen and keyboard |
| Save setup as dfl |
| Save setup as.. |
| Exit |
| Exit from Minicom |

Let’s forget about modems for a moment and assume you want to use COM1 to connect
to a Cisco device at 9600 baud. Use the arrow keys to navigate to Serial port setup
and press Enter to select it. Press a to edit the serial device and change that device to /dev/ttyS0. Next, press e for port settings and when the Comm Parameters screen appears, press e for 9600 baud. To toggle off hardware flow control, press f. Press Enter to return to the configuration screen.

To change modem parameters, select modem and dialing. Then clear the init, reset,
connect, and hangup strings (which are not appropriate for the Cisco device we’re
configuring). When that’s done, select save setup as dfl (default) from the configuration screen and choose Exit (not Exit from Minicom). You’re now in the minicom terminal. To learn more about how to use minicom, press Ctrl+a, then z for help. When you are done, press Ctrl+a, then x to exit from minicom.

WARNING! Do not run minicom inside screen with the default key bindings!
Otherwise, Ctrl+a gets intercepted by screen! If you do so by mistake, go to
another screen window and type: killall minicom.