10.5 Using wvdial

If you have your dial-up network connection working perfectly, you may have little interest in exploring wvdial. However, there are two reasons you should consider learning more about wvdial: you can use wvdial even if X isn't working or isn't installed, and you can use wvdial in shell scripts of your own design. Chapter 13 includes an example script.

10.5.1 The /etc/wvdial.conf File

To configure wvdial, become the root user and issue the following command:

# wvdialconf /etc/wvdial.conf

This command analyzes your system and creates a template configuration file, /etc/wvdial.conf. You must edit this file to specify the username and password your ISP expects.

The contents of the template file look something like this:

[Dialer Defaults]
Modem = /dev/modem
Baud = 115200
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 S11=55 +FCLASS=0
ISDN = 0
; Phone = <Target Phone Number>
; Username = <Your Login Name>
; Password = <Your Password>

Edit the last three lines of the file, deleting the leading semicolon and space and substituting the proper phone number, username, and password required to connect to your ISP. When you're done, your file should look something like this:

[Dialer Defaults]
Modem = /dev/modem
Baud =  115200
Init1 = ATZ
Init2 = ATQ0 V1 E1 &C1 &D2 +FCLASS=0
ISDN = 0
Phone = 15625551100
Username = bill100
Password = donttell

Be sure that only the root user can read the wvdial.conf file. Use a file manager or the shell to change the file's permissions, if necessary. Otherwise, someone who uses your system may discover your password.

Now, you're ready to make a connection by issuing the following command:

# wvdial &

The command generates quite a bit of output, which makes further use of this virtual terminal distracting. The simplest solution is to switch to another terminal window, or to another virtual terminal by pressing Alt-n, where n stands for the virtual terminal (1-7). Alternatively, you can direct the output of the command to a file, by typing this command in place of the one given earlier:

# wvdial 2>/tmp/wvdial.messages &

Of course, you'll need to consult the file if something goes wrong with wvdial. Do so by using the less command:

# less /tmp/wvdial.messages

Once your connection is up, you can browse the Web and access other Internet services. For now, simply verify that your connection is working by issuing the command:

# ping www.redhat.com

The ping command should report that echo packets were successfully received from the server. If not, check your name server configuration and other details, as described earlier in the chapter.

When you want to terminate the Internet connection, issue the command:

# killall wvdial