Evanescent Thoughts

Evanescent Thoughts

Using wvdial in Linux

with 7 comments


For all those who dunno wht wvdial is , its a PPP dialer, which means that it dials a modem and starts PPP in order to connect to the Internet. It takes care of how to dial and log into your server . If u r confused on wht PPP is actually , then i wud suggest u read this.

I never used my dial up modem on my linux machine and i recently gt broad band. But yesterday i was staying in my friends house and he saw linux in my comp and wanted to try it out in his comp. So i did the installation and was happy tht everything worked until he showed me his Reliance Net connect card and asked me how to use it in the newly installed OS. And thts whn i realised how wvdial can come to help.

So the rest of the post will go on describing how wvdial works.So lets tentatively say tht wvdial helps us to use things like our dial-up modem , usb-data card like things in linux.

Actually like all other command utilities , when wvdial starts, it first loads its configuration from /etc/wvdial.conf and ~/.wvdialrc which contains basic information about the modem port, speed, and init string, along with information about your Internet Service Provider (ISP), such as the phone number, your username, and your password.It then initializes the modem and dials the server and waits for a connection and takes care of all cases like phone line busy , no dial tone etc .wvdial has a lots of configuration options by default bt we will see here on how to do the configuration through wvdial.conf.

The configuration file /etc/wvdial.conf has sections named in square brackets and a number of variable = value pairs within each section. A sample file tht i gt from net is as following

[Dialer Defaults]
Modem = /dev/ttyS2
Baud = 57600
Init = ATZ
Init2 = AT S11=50
Phone = 555-4242
Username = apenwarr
Password = my-password

[Dialer phone2]
Phone = 555-4243

[Dialer shh]
Init3 = ATM0

[Dialer pulse]
Dial Command = ATDP

Aa u can see there are four sections in this one. U can define as many as u want . But lets see wht these four sections are .

1)Dialer Defaults 2)Dialer phone 2 3)Dialer ssh 4) Dialer Pulse

Starting with the defaults i picked these defs from the man pages .

Modem
The location of the device that wvdial should use as your modem. The default is /dev/modem.
Baud
The speed at which wvdial will communicate with your modem. The default is 57600 baud.This is something like synchronisation .. or clock pulse period.
Init1 … Init9
wvdial can use up to nine initialization strings to set up your modem. Before dialing, these strings are sent to the modem in numerical order. These are particularly useful when specifying multiple sections. See above for an example that uses Init3 to turn the modem’s speaker off. The default is “ATZ” for Init1.
Phone
The phone number you want wvdial to dial. You can add up to 4 other phone numbers that wvdial will dial in order, by adding:

The next few lines contain the user name and password informations.

Next we see another section with a phone number defined . This means tht after loading the defaults these specific sections can be called upon as per the requirement . For example when u type in just wvdial in terminal , it runs with the settings specified in the default section. But say u want to add a new init string and dial a diff phone number ,then the command would be

wvdial phone2 ssh

This command dials the phone number specified in the phone2 section and loads the init3 string which turns off the modem.

The last secion has the following one

Dial Command
wvdial will use this string to tell the modem to dial. “ATDT” is the default one.

There are also of lots of other options like stupid mode etc which u can chk out by looking at the man pages. This info i guess shud be enough to start with using wvdial in case u have a modem to connect to internet.

Once the wvdial gets running it assigns ip and all other stuff… but i was still unsuccesful in getting the ip info from ifconfig. I guess wvdial doesnt change cant be monitored using ifconfig . Once i connected my reliance card ,using wvdial i got something like this

# wvdial cdma
–> WvDial: Internet dialer version 1.56
–> Cannot get information for serial port.
–> Initializing modem.
–> Sending: ATZ
ATZ
OK
–> Modem initialized.
–> Sending: ATDT#777
–> Waiting for carrier.
ATDT#777
CONNECT 230400
–> Carrier detected. Starting PPP immediately.
–> Starting pppd at Sat Mar 3 22:55:20 2007
–> Pid of pppd: 24314
–> Using interface ppp0
–> local IP address 220.226.50.126
–> remote IP address 97.239.2.10
–> primary DNS address 202.138.103.100
–> secondary DNS address 202.138.96.2

And yeah thts it, i started browsing (though it was terribly slow ) . I actually remember reading wvdial earlier in suren’s blog last year.

Well before winding up, if u found this too techhy to do in command line , there is always GNOME PPP to do it the graphical way .It has lots of check boxes and stuff tht u fill in, it writes into the wvdial.conf file .For brad band u just have to plug in the lan cable. Nothing else has to be done.. since ur modem is already connected to the server.

Advertisements

Written by Sathya Narayanan

November 28, 2008 at 10:44 pm

Posted in computers, Linux

7 Responses

Subscribe to comments with RSS.

  1. There is an easier way out for those who have a PPPoE broadband and have trouble configuring the dialer in linux.. ( was my case )..:
    Call the local BSNL office and change the scheme to always on internet, then the auto-detect works 😛

    Akhil Ravidas

    November 28, 2008 at 11:12 pm

  2. […] Using wvdial in Linux It then initializes the modem and dials the server and waits for a connection and takes care of all cases like phone line busy , no dial tone etc .wvdial has a lots of configuration options by default bt we will see here on how to do … […]

    dns server | CNN.com

    November 29, 2008 at 1:41 pm

  3. Hello,

    Can you please tell me how i would configure:

    Phone = 555-4242
    Username = apenwarr
    Password = my-password

    I just installed Ubuntu and im lost on the configuration of wvdial

    Many Thanks!

    Freddie

    January 1, 2009 at 9:44 am

  4. I entered “/etc/wvdial.conf” on the terminal and i got a “Permission denied” message… is there another way of configuring the data?

    Freddie

    January 1, 2009 at 9:47 am

    • use sudo .

      Sathya Narayanan

      January 1, 2009 at 9:51 am

  5. @akhil.. yea thats way easier.. 🙂

    Saurabh Gupta

    January 2, 2009 at 11:02 pm

  6. please send how to connect usnig mobile……

    Felix Paul

    February 12, 2009 at 11:30 am


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: