Using a wireless USB modem in Linux.

As I have said earlier, I’m writing the methods to use the USB modem in Linux. In this tutorial I have to taken the privilege to believe you are using a recent distro with KDE as the Windowing Manger. In my case, it was Fedora 11 and I’m trying to use the EVDO from BSNL. I also used kppp as the dialer.

I believe by this time you have connected the modem to one of the vacant USB ports. If not, do so. Now our task consists of making the OS detect it and then inputting the correct parameters for the dialer,

The first is pretty straight forward job and you would be able to do this pretty easily. I’m not suggesting the other part is difficult, but without enough documentation and guidelines you are likely wander in Neverland, let alone get in. I did until I tried all the possibilities and dedicated some time to read the manuals. Also I got loads of help from other bloggers. So here I’m providing the little I learned from the experience. I hope it helps you.

First login as the super user. You need admin powers to execute certain commands.

1. Find the the vendor and product id of the modem.
You can do this in two ways
a) cat /proc/duc/usb/devices
This will give a list of the USB devices. Find the make of yours from the list. Most probably it will output something similar to

P: Vendor=05c6 ProdID=6000 Rev= 0.00
S: Manufacturer=ZTE, Incorporated
S: Product=ZTE CDMA Tech

b) You may also execute lsusb command
It will give another list and your device may be listed something like
Bus 001 Device 002: ID 05c6:6000 Qualcomm, Inc.

Note that even though the make of your device is ZTE, it is shown as Qualcomm here. It doesn’t matter. What we are really after are the hex codes for the product code and vendor id. We understand that the vendor is 05c6 and product id is 6000 in our case.

2. Now we need to detect the modem using modprobe command. Please input the following in the terminal.
modprobe usbdserial vendor=0x05c6 product=0x6000
This will detect the modem for you. Please make sure the ids are in hex (ie, there is 0x in front of the codes). You can automate this process by adding ‘usbserial vendor=0x05c6 product=0x6000‘ to file “/etc/modules“. This will execute the command each time the system starts up.

3. You may check whether it was successful by running dmesg command. If successful it will give output with lines similar to the following.
usbserial_generic 1-3:1.0: generic converter detected
usb 1-3: generic converter now attached to ttyUSB0
usbserial_generic 1-3:1.1: generic converter detected
usb 1-3: generic converter now attached to ttyUSB1
usbserial_generic 1-3:1.2: generic converter detected
usb 1-3: generic converter now attached to ttyUSB2

Now it means our modem has been detected and it is called ttyUSB0 by Linux. Now that we have finished the first part we are now into configuring the dialler. Here also you can follow two methods. Either by configuring kppp, the pppd dialler in KDE or editing the wvdial.conf file and using the terminal to dial in. I will explain both, though I prefer the former (If you Desktop manager is Gnome, you may not able to use kppp, but may be able to follow the wvdial method. I’m not sure, Please try and let me know).

Configuring kppp.

Please launch kppp (Where you find it under the start menu may differ for different distros. Please consult your distro’s manual for finding it). Yo will get an interface with a username and password option. At first it will be blank. You need to configure it before using it. Please click the ‘Configure’ button to open a new panel.

1. Under the many tabs, please make sure the ‘Accounts‘ tab is active and click the ‘New‘ button. Check the ‘Manual Setup‘ button in the new window.
2.A new window is opened with more tabs out of which the first one is ‘Dial‘. Add whatever name you like in the ‘Connection Name‘ field. Add new phone number. In BSNL’s case it is #777 or *99***1#.
3. Make sure PAP is selected under the Authentication field. The default is PAP/CHAP. Since BSNL gave ulogin credentials we need to authenticate ourselves with the server. PAP ensures it. Since the BSNL server doesn’t need to authenticate itself to our system, we can let go off channel handshaking and thus the CHAP protocol. This is atmost important whose failure may cause kppp to quit with an error code 19.
4. No need to bother with any other tabs. Let them remain as it is. Confirm the changes to come back to the initial window.
5. Now access the ‘Modems‘ tab. Click ‘New‘ to open a new window.
6. Enter a name for the modem and select ‘/dev/ttyUSB0‘ from the ‘Modem Device’ drop down in the ‘Device’ tab.
7. Now access the ‘Modem’ tab and uncheck the ‘Wait for dialtone before dialling‘ option. Confirm the changes to go back to the initial screen. Enter the username and password in the fields and we are 80% finished.

Now comes two of the most important configuration without which you are as good as you were in the beginning. If we try to dial in now, we will see that the dialer quits with an error 19. You will be searching in dark as you are sure there is no issues with the login credentials and you have entered the correct. Even re entering them won’t help. you will still stumble at the same block.

So what is the real issue here. You need someone to point out or extreme patience to read the manuals to find out. The kppp help is extremely good. It together with some online help ( rebooting OS’s alternatively to check the net and try the findings can be tiresome but is necessary at times like these) can eventually lead you to the solution. But don’t worry I had done all the hard work for you. All you need to do is do a couple more of fixes.

1. The “pppd died – The remote system is required to authenticate itself …” or the code no 19 error is caused due to two reasons.
Either the /etc/ppp/options contains the auth option or your system already has a default route. In this case recent versions of pppd will behave as if auth had been specified. To ward off the first issue add a ‘#’ symbol in front of it and to override the second option you may add noauth to the file.

This enables your modem to connect to the internet. But this doesn’t fully solve the issue. You will notice the browser is still not loading the pages. This time you will be in more despair as there isn’t a good error message along with it. But nothing is impossible. You are indeed destined to browse net from your Linux box. Just perform the next fix.

2. Add the following lines in the to the /etc/resolv.conf file

These are the ip addresses of OpenDNS servers. It’s secure, fast and trusted service. It’s better than the ISP’s servers ad I suggest you use them. You can learn more about them at the company site.

Voila! you are done and is now you are eligible for the ‘Geek of the Hour’ award. Happy browsing.

Editing wvdial.conf
Now for the command line method add a new file wvdial.conf in the /etc folder in addition to former files of resolv.conf and ppp/options file. Most probably the wvdial may be present you may just need to edit it. If not you may need to install wvdial. Check with the OS manual for the method.
Add the following to the file

[Dialer Defaults]
Modem = /dev/ttyUSB0
Dail Command = ATDT
init1 = ATZ
init2 = AT+CRM = 1
Flow Control = Hardware (CRTSCTS)
Username = <substitute yours>
Password = <substitute yours>
Phone = #777
Stupid Mode = 1
Auto DNS = 1

Save the file and execute wvdial from terminal and you are connected to the internet. Never close the window until you are done browsing.

There is one more issue we need to address. Kppp wouldn’t work normally if you log out of the root privilege. For a workaround see the end of this post.
I wish this serves as a good tutorial to using USB modem in Linux. Wish you happy browsing.

add to : Add to Blinkslist : add to furl : Digg it : Stumble It! : add to simpy : seed the vine : : : TailRank : post to facebook