How to Use a Mobile Phone as Modem in Linux

Posted by jun auza On 2/06/2008
Last month, my home internet connection got disconnected a couple of times. However, I'm glad and lucky that I have a cell phone that I can use as a modem for my Linux box every time my internet provider messes up.

I'm going to share to all of you how I use my Nokia 9500 Communicator mobile phone as Modem.

Note: this may also work with other Nokia cellular phone models that have internet capability.


1. Connect your phone to the computer via USB cable.

2. Open a terminal and type:

lsusb

3. You will get an output almost similar to this one:

jda@linux-lab:~$ lsusb
Bus 003 Device 004: ID 0421:0405 Nokia Mobile Phones 9500 GSM Communicator
Bus 003 Device 002: ID 05e3:0606 Genesys Logic, Inc.
Bus 003 Device 001: ID 0000:0000
Bus 001 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 001 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000

4. Notice the numbers 0421 & 0405 on the line in which 'Nokia Mobile Phones' is displayed. 0421 is the Vendor ID (VID), while 0405 is the Product ID (PID). We will use these numbers later as 0x421 & 0x405.

5. Enter this command:

sudo /sbin/modprobe usbserial vendor=0x(VID) product=0x(PID)

eg, in my case: sudo /sbin/modprobe usbserial vendor=0x421 product=0x405

6. Now enter this command:

wvdialconf create

7. You will get an output which will be similar to this:

Editing `create'.

Scanning your serial ports for a modem.

WvModem<*1>: Cannot set information for serial port.
ttyS0<*1>: ATQ0 V1 E1 -- failed with 2400 baud, next try: 9600 baud
ttyS0<*1>: ATQ0 V1 E1 -- failed with 9600 baud, next try: 115200 baud
ttyS0<*1>: ATQ0 V1 E1 -- and failed too at 115200, giving up.
Modem Port Scan<*1>: S1 S2 S3
WvModem<*1>: Cannot get information for serial port.
ttyACM0<*1>: ATQ0 V1 E1 -- OK
ttyACM0<*1>: ATQ0 V1 E1 Z -- OK
ttyACM0<*1>: ATQ0 V1 E1 S0=0 -- OK
ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 -- OK
ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK
ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
ttyACM0<*1>: Modem Identifier: ATI -- Nokia
ttyACM0<*1>: Speed 4800: AT -- OK
ttyACM0<*1>: Speed 9600: AT -- OK
ttyACM0<*1>: Speed 19200: AT -- OK
ttyACM0<*1>: Speed 38400: AT -- OK
ttyACM0<*1>: Speed 57600: AT -- OK
ttyACM0<*1>: Speed 115200: AT -- OK
ttyACM0<*1>: Speed 230400: AT -- OK
ttyACM0<*1>: Speed 460800: AT -- OK
ttyACM0<*1>: Max speed is 460800; that should be safe.
ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK

Found an USB modem on /dev/ttyACM0.
Modem configuration written to create.
ttyACM0: Speed 460800; init "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"

8. Find the location of the modem, in my case at /dev/ttyACM0, and also the Max speed which is 460800.

9. Now enter this command:

sudo vi /etc/wvdial.conf

Note: You can use any text editors. I used Vi here.

10. A file will open. Delete everything in that file and replace it with the following: (Don't forget to put the 'modem location' and 'max speed')

[Dialer Defaults]
Modem = PUT MODEM LOCATION HERE
Baud = PUT MAX SPEED HERE
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ISDN = 0
Modem Type = Analog Modem
Phone = *99#
Username = username
Password = password
Stupid Mode = 1

11. Save the file, and the setup is done.

12. You can connect by opening a terminal and then typing the command: wvdial. You will then get an output like shown below if everything worked as expected.

jda@linux-lab:~$ wvdial
WvDial<*1>: WvDial: Internet dialer version 1.56
WvModem<*1>: Cannot get information for serial port.
WvDial<*1>: Initializing modem.
WvDial<*1>: Sending: ATZ
WvDial Modem<*1>: ATZ
WvDial Modem<*1>: OK
WvDial<*1>: Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
WvDial Modem<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
WvDial Modem<*1>: OK
WvDial<*1>: Modem initialized.
WvDial<*1>: Sending: ATDT*99#
WvDial<*1>: Waiting for carrier.
WvDial Modem<*1>: ATDT*99#
WvDial Modem<*1>: CONNECT
WvDial Modem<*1>: ~[7f]}#@!}!} } }2}#}$@#}!}$}%\}"}&} }*} } g}%~
WvDial<*1>: Carrier detected. Starting PPP immediately.
WvDial: Starting pppd at Wed Feb 6 21:53:10 2008
WvDial: Warning: Could not modify /etc/ppp/pap-secrets: Permission denied
WvDial: --> PAP (Password Authentication Protocol) may be flaky.
WvDial: Warning: Could not modify /etc/ppp/chap-secrets: Permission denied
WvDial: --> CHAP (Challenge Handshake) may be flaky.
WvDial: Pid of pppd: 5936
WvDial<*1>: Using interface ppp0
WvDial<*1>: pppd: ��[06][08]ؗ[06][08]
WvDial<*1>: pppd: ��[06][08]ؗ[06][08]
WvDial<*1>: pppd: ��[06][08]ؗ[06][08]
WvDial<*1>: pppd: ��[06][08]ؗ[06][08]
WvDial<*1>: pppd: ��[06][08]ؗ[06][08]
WvDial<*1>: local IP address 10.157.42.199
WvDial<*1>: pppd: ��[06][08]ؗ[06][08]
WvDial<*1>: remote IP address 10.6.6.6
WvDial<*1>: pppd: ��[06][08]ؗ[06][08]
WvDial<*1>: primary DNS address 121.1.3.208
WvDial<*1>: pppd: ��[06][08]ؗ[06][08]
WvDial<*1>: secondary DNS address 121.1.3.199
WvDial<*1>: pppd: ��[06][08]ؗ[06][08]

13. You are now connected. Disconnect by hitting Ctrl+c.


Bookmark and Share

Related Posts:



Archive


"Action is the real measure of intelligence" ~Napoleon Hill

Twitter

Tumblr

Google +