January 2nd, 2009

Tips [Linux] How to setup USB 3G or GPRS modem

Computer Hardware & Software, Tips & trick, by brigs.

Since 2.6.x  kernel release, all linux distribution have “Hal Daemon” that act like windows service to recognize new plug-play hardware without kernel database driver. HAL makes information about certain classes of hardware accessible in a uniform format. When a new device powers up within the system (an event known as hotplugging), it can broadcast an asynchronous signal on the system message bus of the D-Bus IPC mechanism giving details of the new device and its capabilities.  It’s different approach like kernel based know hardware such as SCSI (Small Computer Serial Interface) or IDE interface, Serial port etc. Rightnow we can see almost all equipment hardware using USB interface for connecting.


For ensuring your peripheral is connected and known by kernel you may type

localhost$lsusb
Bus 003 Device 002: ID 22b8:4902 Motorola PCS E398 GSM Phone
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 005: ID 04fc:0c15 Sunplus Technology Co., Ltd
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 002: ID 0c45:0100 Microdia
Bus 001 Device 001: ID 0000:0000

At above sample ID 22b8:4902 recognized to my Motorola phone modem L6 act like modem. Sunplus Technology at ID 04fc:0c15 to my external HDD Sata Drive controller and at ID  0c45:0100 or Microdia to my USB Laser mouse. AT this tutorial, i will give you how to setup modem especially USB interface on Linux system and for experiment i using OpenSuse 10.3 x86 installed.

Check your linux installation for ensuring you have been installing a kinternet (cause i prefer use KDE in my desktop) and wvdial for scripting dial-up.  There is 2 way connecting modem to the internet, the easy used from Yast “modem configuration” and the second way is from wvdial configuration script.

Yast configuration..

1. Open Yast -> Network device -> modem configuration page and let Hal on Suse recognizing your modem.

2. Choose modem device gateway for your USB modem type. How do i know the right choice for my modem ? answer is easy, you just open message log kernel at /var/log with root privilege. Find parameter such as

localhost kernel: usb 3-2: new full speed USB device using ohci_hcd and address 2
localhost kernel: usb 3-2: new device found, idVendor=22b8, idProduct=4902
localhost kernel: usb 3-2: new device strings: Mfr=1, Product=2, SerialNumber=0
localhost kernel: usb 3-2: Product: Motorola Phone (L6)
localhost kernel: usb 3-2: Manufacturer: Motorola Inc.
localhost kernel: usb 3-2: configuration #1 chosen from 2 choices
localhost kernel: cdc_acm 3-2:1.0: ttyACM0: USB ACM device
localhost kernel: usbcore: registered new interface driver cdc_acm
localhost kernel: drivers/usb/class/cdc-acm.c: v0.25:USB Abstract Control Model driver for USB modems and ISDN adapters

At these message log my modem is connected from /dev/ttyACM0, and setup these device modem parameter.

3. Next step is configuring your modem like figure behind, check kinternet use for non root and don’t forget to setup your ISP (for sample i using TelkomFlash). For modem init 3 some ISP need to be configured like AT+CGDCONT=1,”IP”,”provider.id” for string to act remote server connection.

4. For security reason, that’s nothing false if you check external firewall interface for your connection.

5. After all setup mode finished, last action is activating smppd daemon for connection between kinternet and your modem.

Wvdial script configuration :

After installing wvdial, find file configuration for using scripting modem config. The filename is wvdial.conf and usually can found at /etc directory. Edit the file with your favorite editor. I shall use nano for console editor.

localhost#~> sudo  nano /etc/wvdial.conf

use these script for modem and Telkomflash configuration :

[Dialer flash]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=1,”IP”,”telkomsel”
Password =
Phone = *99#
New PPPD = yes
Modem Type = USB Modem
Stupid Mode = 1
Baud = 460800
Auto DNS = 1
Modem = /dev/ttyACM0
ISDN = 0
username = null
Auto Reconnect = On

And for Indosat Broom, you can used like these :

[Dialer broom]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=1,”IP”,”INDOSATM2″
Password = your password
Phone = *99#
New PPPD = yes
Modem Type = USB Modem
Stupid Mode = 1
Baud = 460800
Auto DNS = 1
Modem = /dev/ttyACM0
ISDN = 0
username = your login
Auto Reconnect = On

Save the file and exit, last one you can check with :

localhost#sudo wvdial flash

–> WvDial: Internet dialer version 1.56 (abuild@balli)
–> Cannot get information for serial port.
–> Initializing modem.
–> Sending: ATZ
ATZ
OK
–> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
–> Sending: AT+CGDCONT=1,”IP”,”telkomsel”
AT+CGDCONT=1,”IP”,”telkomsel”
OK
–> Modem initialized.
–> Idle Seconds = 300, disabling automatic reconnect.
–> Sending: ATDT*99#
–> Waiting for carrier.
ATDT*99#
CONNECT
~[7f]}#@!}!} } }2}#}$@#}!}$}%}”}&} }*} } g}%~
–> Carrier detected. Starting PPP immediately.
–> Starting pppd at Thu Jan 8 16:33:23 2009
–> Pid of pppd: 4688
–> Using interface ppp0
–> pppd: [11][06][08]
–> pppd: [11][06][08]
–> local IP address 10.134.171.86
–> pppd: [11][06][08]
–> remote IP address 10.6.6.6
–> pppd: [11][06][08]
–> primary DNS address 202.3.208.10
–> pppd: [11][06][08]
–> secondary DNS address 202.3.210.10
–> pppd: [11][06][08]
–> Script /etc/ppp/ip-up run successful
–> Default route Ok.
–> Nameserver (DNS) Ok.
–> Connected… Press Ctrl-C to disconnect
–> pppd: [11][06][08]

Done !.. For last check you may using “iftop” in text based monitoring or “gkrellm”monitoring your speed connection.

Check your speed connection at speedtest.net

Back Top

Responses to “Tips [Linux] How to setup USB 3G or GPRS modem”

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Back Top

icon_wink.gif icon_neutral.gif icon_mad.gif icon_twisted.gif icon_smile.gif icon_eek.gif icon_sad.gif icon_rolleyes.gif icon_razz.gif icon_redface.gif icon_surprised.gif icon_mrgreen.gif icon_lol.gif icon_idea.gif icon_biggrin.gif icon_evil.gif icon_cry.gif icon_cool.gif icon_arrow.gif icon_confused.gif icon_question.gif icon_exclaim.gif 

SEO Powered by Platinum SEO from Techblissonline