Connecting to Internet via mobile phone in linux

Let me tell you how I connected to Internet using my mobile phone (Samsung c3200) on linux using wvdial. Let me break it down in steps so it is easy to understand. Let's get started.

Step 1: plug in the phone using data cable
Step 2: Running lsusb
Run lsusb command. Output on my pc is like this.

 [noel@Daedalus ~]$ lsusb Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 007: ID 04e8:6843 Samsung Electronics Co., Ltd 

Notice the last line. It means that my mobile is detected succesfully. Also notice the weird codes after ID. That's what we need.

Step 3: Loading kernel modules Kernel modules are loaded with modprobe command. For my mobile it will look like this:

 modprobe usbserial vendor=0x04e8 product=0x6843 (run as root) 

If you have different lsusb output, then use those IDs in the modprobe command.

Step 4: Configuring wvdial Normally wvdial is configured simply by executing the command wvdialconf. However, I already use wvdial for one data card and didn't want to overwrite the working config file in /etc. So I issued command:

 wvdialconf samsung.conf (run as root) 

It will write all the configurations in the samsung.conf file instead of the default /etc/wvdial.conf. Let's see what I've got.]

 Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 Modem Type = USB Modem ; Phone = <Target Phone Number> ISDN = 0 ; Username = <Your Login Name> Init1 = ATZ ; Password = <Your Password> Modem = /dev/ttyACM0 Baud = 460800 

Step 5: Add the phone number and credentials. Now comes the tricky part. You need to know which number to dial and the login credentials. I have a vodafone connection here so I knew I need to dial *99# in order to connect to internet. However the problem was that the connection didn't need any username and password. It just connected to the internet. That was a problem for me. When I tried to connect to internet wvdial complained that there were no valid username and password in the configuration. The errors were:

 –> Configuration does not specify a valid login name.  –> Configuration does not specify a valid password.  

So, I installed opera mini in my mobile and went online and search for the solution. I found out that you can put username = user and password = pass as default values. I edited the configuration file accordingly. My final confinguration file looked like this.

 [Dialer Defaults] Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 Modem Type = USB Modem Phone = *99# ISDN = 0 Username = user Init1 = ATZ Password = pass Modem = /dev/ttyACM0 Baud = 460800 

Then I did:

 wvdial -C samsung.conf (run as root) 

Woohooo. Internet connected via mobile.