Installing and Configuring USB 3G DataCard on CentOS/RHEL 6.3

This article will guide you through the installation and configuration steps of 3G USB Huawei Modem on CentOS 6.3.

Follow the steps mentioned in the following order.

1) Prerequisite

  • CentOS/RHEL 6.3 server in working condition.

  • Following dependent package that needs to be installed first.

   yum install wvdial usb_modeswitch-data usb_modeswitch

As this system is not connected to internet so in that case you need to download the above package from following site (different machine that has Internet access) on your Pen Drive or other media.

   http://mirror.centos.org/centos/6/os/x86_64/Packages/wvdial
   http://pkgs.repoforge.org/usb_modeswitch-data
   http://pkgs.repoforge.org/usb_modeswitch


You need to manually install the rpm

   rpm -ivh wvdial-1.60-12.el6.x86_64.rpm usb_modeswitch-1.2.3-1.el6.rf.x86_64.rpm usb_modeswitch-data-20120120-1.el6.rf.noarch.rpm 


Connect the USB 3G Dongle on the system and check the device is detected using lsusb command or in /var/log/messages.

   lsusb
   Bus 001 Device 003: ID 12d1:140c Huawei Technologies Co., Ltd.


OR

   tail -f /var/log/messages

   Aug 1 11:09:04 localhost kernel: usb 1-7: Product: HUAWEI Mobile
   Aug 1 11:09:04 localhost kernel: usb 1-7: Manufacturer: HUAWEI Technology

Check the device type by which modem is connected using dmesg.

   dmesg | grep tty

   usb 1-8: GSM modem (1-port) converter now attached to ttyUSB0
   usb 1-8: GSM modem (1-port) converter now attached to ttyUSB1
   usb 1-8: GSM modem (1-port) converter now attached to ttyUSB2
   usb 1-8: GSM modem (1-port) converter now attached to ttyUSB3

Once USB is connected and detected, now is the time to configure wvdial.

   vi /etc/wvdial.conf 
   [Dialer Defaults]
   Init1 = ATZ
   Init2 = ATQ0 V1 E1 S0=0 &C1 &D2
   Init3 = AT+CGDCONT=1,"IP","airtelgprs.com"
   stupid mode = 1
   Modem Type = USB Modem
   Baud = 460800
   New PPPD = yes
   Modem = /dev/ttyUSB0
   ISDN = 0
   Phone = *99#
   Carrier Check = no
   Password = airtel
   Username = airtel
   FlowControl=Hardware(CRTSCTS)

Once we have prepared the config file now is the time to connect wvdial.

   wvdial
   --> WvDial: Internet dialer version 1.60
   --> Cannot get information for serial port.
   --> Initializing modem.
   --> Sending: ATZ
   OK
   --> Sending: ATQ0 V1 E1 S0=0 &C1 &D2
   ATQ0 V1 E1 S0=0 &C1 &D2
   OK
   --> Sending: AT+CGDCONT=1,"IP","airtelgprs.com"
   AT+CGDCONT=1,"IP","airtelgprs.com"
   OK
   --> Modem initialized.
   --> Sending: ATDT*99#
   --> Waiting for carrier.
   ATDT*99#
   CONNECT
   --> Carrier detected.  Starting PPP immediately.
   --> Starting pppd at Mon Aug  5 18:55:58 2013
   --> Pid of pppd: 3070
   --> Using interface ppp0
   --> pppd: ?
   --> pppd: ?
   --> pppd: ?
   --> pppd: ?
   --> pppd: ?
   --> local  IP address 223.228.201.19
   --> pppd: ?
   --> remote IP address 10.64.64.64
   --> pppd: ?
   --> primary   DNS address 125.22.47.102
   --> pppd: ?
   --> secondary DNS address 125.22.47.103
   --> pppd: ?


Check the logs (/var/log/messages) and try to make entry of Primary and Secondary DNS server in /etc/resolv.conf, if it is not updated.

   Aug 1 14:35:40 localhost pppd[3794]: pppd 2.4.5 started by root, uid 0
   Aug 1 14:35:40 localhost pppd[3794]: Using interface ppp0
   Aug 1 14:35:40 localhost pppd[3794]: Connect: ppp0 <--> /dev/ttyUSB0
   Aug 1 14:35:40 localhost pppd[3794]: CHAP authentication succeeded
   Aug 1 14:35:40 localhost pppd[3794]: CHAP authentication succeeded
   Aug 1 14:35:43 localhost pppd[3794]: Could not determine remote IP address: defaulting to 10.64.64.64
   Aug 1 14:35:43 localhost pppd[3794]: local IP address 106.200.21.246
   Aug 1 14:35:43 localhost pppd[3794]: remote IP address 10.64.64.64
   Aug 1 14:35:43 localhost pppd[3794]: primary DNS address 125.22.47.102
   Aug 1 14:35:43 localhost pppd[3794]: secondary DNS address 125.22.47.103
   Aug 1 14:35:45 localhost ntpd[2903]: Listening on interface #5 ppp0, 106.200.21.246#123 Enabled


Resolv file will look like

   vi /etc/resolv.conf 
   nameserver 125.22.47.102
   nameserver 125.22.47.103

Congratulation now you are connected, grap a glass of bear and enjoy surfing the Net.

Debugging steps

*) Check device is in Storage or Modem Mode.

**) Use usb-devices or lsusb command to check.

   usb-devices
   T: Bus=01 Lev=01 Prnt=01 Port=07 Cnt=01 Dev#= 9 Spd=480 MxCh= 0
   D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
   P: Vendor=12d1 ProdID=1446 Rev=00.00
   S: Manufacturer=HUAWEI Technology
   S: Product=HUAWEI Mobile
   C: #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA
   I: If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
   I: If#= 1 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage


OR

   lsusb
   Bus 001 Device 003: ID 12d1:1446 Huawei Technologies Co., Ltd. E1552/E1800/E173 (HSPA modem)

1446” is the product id for the file mode of this dongle. (It is in Storage mode).

   lsusb
   Bus 001 Device 003: ID 12d1:140c Huawei Technologies Co., Ltd.

140c” is the product id for the file mode of this dongle. (It is in USB mode).

**) Load the usbserial kernel module using following command.

   modprobe usbserial vendor=0x12d1 product=0x140c


**) usb_modeswitch package is used to switch the USB dongle from CDROM file system to Modem mode (→ flip flop).

Create the following file.

   cat /etc/usb_modeswitch.conf
   DefaultVendor= 0x12d1 
   DefaultProduct=0x1446 

   TargetVendor= 0x12d1 
   TargetProductList="1001,1406,140b,140c,141b,14ac" 

   CheckSuccess=20 MessageContent="55534243123456780000000000000011060000000000000000000000000000" 

**) Now run the following command to switch from storage to modem mode.

   usb_modeswitch -c /etc/usb_modeswitch.conf
   Check the /var/log/message it will show something like
   Aug 1 14:35:08 localhost kernel: usb 1-8: configuration #1 chosen from 1 choice
   Aug 1 14:35:08 localhost kernel: option 1-8:1.0: GSM modem (1-port) converter detected
   Aug 1 14:35:08 localhost kernel: usb 1-8: GSM modem (1-port) converter now attached to ttyUSB0
   Aug 1 14:35:08 localhost kernel: option 1-8:1.1: GSM modem (1-port) converter detected
   Aug 1 14:35:08 localhost kernel: usb 1-8: GSM modem (1-port) converter now attached to ttyUSB1
   Aug 1 14:35:08 localhost kernel: option 1-8:1.2: GSM modem (1-port) converter detected
   Aug 1 14:35:08 localhost kernel: usb 1-8: GSM modem (1-port) converter now attached to ttyUSB2
   Aug 1 14:35:08 localhost kernel: option 1-8:1.3: GSM modem (1-port) converter detected
   Aug 1 14:35:08 localhost kernel: usb 1-8: GSM modem (1-port) converter now attached to ttyUSB3
   Aug 1 14:35:08 localhost kernel: scsi23 : SCSI emulation for USB Mass Storage devices
   Aug 1 14:35:08 localhost kernel: scsi24 : SCSI emulation for USB Mass Storage devices
   Aug 1 14:35:09 localhost modem-manager: (ttyUSB0) opening serial device...


**) Now try the steps mentioned from Steps 5 onwards.

*) Also try to remove any other mounted usb storage media and try the steps mentioned above once again.


   Reference for further reading
   *) https://wiki.archlinux.org/index.php/3G_and_GPRS_modems_with_pppd
   *) https://wiki.archlinux.org/index.php/USB_3G_Modem

Advertisements

4 thoughts on “Installing and Configuring USB 3G DataCard on CentOS/RHEL 6.3

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