Setting up a serial modem using Wvdial

From NewbieDOC


Chris Lale
chrislale AT users DOT berlios DOT de

Latest version

You can find the latest version of this document at http://newbiedoc.berlios.de.

Revision History

Revision 1.0 5th July 2005 Revised by Chris Lale
Initial Release.
Revision 1.1 1st February 2006 Revised by Chris Lale
Revised for NewbieDOC wiki by converting source to wikitext. Made a few other minor alterations.

Abstract

This article explains how to install and use a serial modem for internet access on a Debian GNU/Linux computer using Wvdial. Wvdial is a command line program. These instructions have been tested in Debian 3.1 (Sarge) with a serial port modem. They have not been tested for a USB modem. If you have an internal modem ('winmodem') go to http://www.linmodems.org/ for advice.

Contents


1 Documentation

1.1 FAQ

http://www.dsb3.com/wvdial/

1.2 Manual pages

Man pages are available after you have installed the Debian packages.

  • wvdial (1)
  • wvdial.conf (5)
  • wvdialconf (1)

You can read the man pages using the man command:

$ man 1 wvdial
$ man 5 wvdial.conf
$ man 1 wvdialconf

2 Before you start

Make sure that you have

  • your internet provider's phone number
  • your internet account login name
  • your internet account password.

Make sure that your modem is connected to the telephone socket, the serial port socket and the power supply. Remember to switch the modem on.

3 Installing and configuring Wvdial

3.1 Installing the Debian packages

Install the wvdial package as user root. You can use Aptitude, Apt-get or Synaptic (in X).

You will be asked if you wish to configure Wvdial automatically. Answer yes by pressing the 'y' key.

WVDIAL AUTOCONFIGURATION WvDial includes a program called wvdialconf, 
which can automatically detect your modem and create a /etc/wvdial.conf file. 

Autodetection may cause problems on some computers. 

Do you want to configure wvdial now? [Y/n] 
y

3.2 Autoconfiguring Wvdial

If you entered 'y', Wvdial autoconfiguration begins. You must supply your internet provider's phone number; your internet account login name and your internet account password.

Okay. You now need to specify three facts about your internet account:
- Your internet provider's phone number;
- Your internet account login name;
- Your account password.

Phone number: 0123456789
Login Name: abcdefgh
Password:
Re-enter:

Phone: "0123456789" -- Login: "abcdefgh" -- Password: 
Is this correct? [Y/n]
y

Wvdial will try to detect your modem. The screen output will look something like this:

Scanning your serial ports for a modem.

ttyS0: ATQ0 V1 E1 -- OK
ttyS0: ATQ0 V1 E1 Z -- OK
ttyS0: ATQ0 V1 E1 S0=0 -- OK
ttyS0: ATQ0 V1 E1 S0=0 &C1 -- OK
ttyS0: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK
ttyS0: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
ttyS0: Modem Identifier: ATI -- 645
ttyS0: Speed 4800: AT -- OK
ttyS0: Speed 9600: AT -- OK
ttyS0: Speed 19200: AT -- OK
ttyS0: Speed 38400: AT -- OK
ttyS0: Speed 57600: AT -- OK
ttyS0: Speed 115200: AT -- OK
ttyS0: Max speed is 115200; that should be safe.
ttyS0: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
Port Scan: S2 S3 S4 S5 S6 S7 S8 S9
Port Scan: S10 S11 S12 S13 S14 S15 S16 S17
Port Scan: S18 S19 S20 S21 S22 S23 S24 S25
Port Scan: S26 S27 S28 S29 S30 S31 S32 S33
Port Scan: S34 S35 S36 S37 S38 S39 S40 S41
Port Scan: S42 S43 S44 S45 S46 S47 S48 S49
Port Scan: S50 S51 S52 S53

If all goes well, you will get a summary like this.

Found a modem on /dev/ttyS0.
Modem configuration written to /etc/wvdial.conf.
ttyS0: Speed 115200; init "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"

Success! You can run "wvdial" to connect to the internet.
(You can also change your configuration by editing /etc/wvdial.conf)

If not, you may need to consider using pppconfig, pon and poff instead of wvdial.

3.3 Re-running wvdial autoconfiguration

If you ever wish to run the autoconfiguration again, use dpkg-reconfigure from the command line (as user root)

# dpkg-reconfigure wvdial

or use Synaptic in X

  • Package -> Configure...

4 Connecting to the internet for the first time

At first, only user root may be able to connect successfully. Enter wvdial at the root prompt to connect.

# wvdial

Wvdial initialises the modem and connects to the ISP's sever.

--> WvDial: Internet dialer version 1.54.0
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Modem initialized.
--> Sending: ATDT0123456789
--> Waiting for carrier.
ATDT08451203070
CONNECT 44000
--> Carrier detected. Waiting for prompt.

Wvdial authenticates to the ISP's server.

Username:
--> Looks like a login prompt.
--> Sending: abcdefgh
abcdefgh
Password:
--> Looks like a password prompt.
--> Sending: (password)
Authentication Successful.
Entering PPP mode.
Async interface address is unnumbered (Loopback0)
Your IP address is 255.255.255.255. MTU is 1500 bytes
Header compression will match your system.
--> Looks like a welcome message

Wvdial starts the pppd daemon. This is why you have to be root on this occasion.

--> Starting pppd at Mon Jul 4 14:55:52 2005
--> pid of pppd: 5186
--> Using interface ppp0
--> local IP address 255.255.255.255
--> remote IP address 255.255.255.255
--> primary DNS address 255.255.255.255
--> secondary DNS address 255.255.255.255

5 Testing the connection

Use Ping to test the connection by querying the ISP's nameservers with a domain name eg google.co.uk. Open a terminal or terminal window and enter the ping command as user root. You should should see replies like these.

# ping google.co.uk
PING google.co.uk (216.239.57.104) 56(84) bytes of data.
64 bytes from 216.239.57.104: icmp_seq=1 ttl=244 time=159 ms 
64 bytes from 216.239.57.104: icmp_seq=2 ttl=244 time=160 ms
64 bytes from 216.239.57.104: icmp_seq=3 ttl=244 time=160 ms
64 bytes from 216.239.57.104: icmp_seq=4 ttl=244 time=160 ms
64 bytes from 216.239.57.104: icmp_seq=5 ttl=244 time=159 ms

Stop Ping with ctrl-C (hold down the Control key and press the C key).

^C
--- google.co.uk ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4002ms
rtt min/avg/max/mdev = 159.865/160.407/160.875/0.603 ms
# 

5.1 Troubleshooting

If you do not get any replies from ping

  • Check that you are root (with the '#' prompt). If not, hang up, log in as root and reconnect.
  • Check that networking is not running on your system.
# /etc/init.d/networking stop

Hang up, and reconnect.

6 Hanging up

Hang up with ctrl-C (hold down the Control key and press the C key).

^C
Caught signal #2! Attempting to exit gracefully...
--> Terminating on signal 15
--> Connect time 0.4 minutes.
--> Disconnecting at Mon Jul 4 14:56:18 2005
#


7 Connecting as a non-root user

Users who connect to the internet must be able to start ppp. The users must belong to group dip. There are detailed instructions for managing users and groups at http://newbiedoc.berlios.de/index.php/Manage_users_and_groups.

You can check the groups you belong to with the groups command. Enter the command from the user's prompt at the command line. Here is the result for a user called username who does not belong to group dip.

$ groups
username dialout cdrom floppy audio video plugdev

Add a user to the dip group with the command adduser username dip (as root, of course).

# adduser username dip

If the user has a session running, the user must logout and login again before the new group membership takes effect. User username should now be able to connect to the internet using Wvdial.

$ wvdial

8 Appendix A: Licence

Copyright ©2005 Chris Lale. chrislale AT users DOT berlios DOT de.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license can be found at http://www.fsf.org/copyleft/fdl.html.

Content is available under GNU Free Documentation License 1.2, unless otherwise stated.