Connect Airtel 4G dongle in Ubuntu 14.04 LTS 64-bit, using Network Manager

The connection manager GUI app shipped with Airtel 4G dongle has trouble running in 64-bit Ubuntu 14.04.
I had previously written a post on a quick fix for this. But that was a temporary fix which could easily break as other libraries are installed or when you simply do a system upgrade.

Below we go through the steps of making the dongle work using the Network Manager shipped with Ubuntu. If required, we'll go ahead and install the utilities: usb-modeswitch and wvdial.

Part A : Adding a new connection

In the best case, you plug in your dongle and it is detected as a modem by Ubuntu.

1) Click on Network Connections icon in the task bar and choose 'Edit Connections'.



2)  Select 'Add -> Mobile Broadband'. Click on 'Create'.
3) If the modem is detected, it'll be listed in the next screen (Eg: ZTE WCDMA Technologies MSM). If you can't find this, skip to Part B below and work through the steps to make Ubuntu detect your modem.
4) Select Country: India, Provider: Airtel. Click 'Continue', and finally 'Apply'.
5) You can choose a custom name for the Connection in the resulting window. This will be listed in your network connections now, and can be clicked to connect to Airtel 4G.

Note: If you're facing immediate disconnect issues in Step 5 above, you might want to correct your ppp options. Check Part C below.

Part B : USB Mode Switching

1) Install latest version of usb-modeswitch, usb-modeswitch-data, and libusb from developer website. DON'T use apt-get as it may not have the latest version.
After installing the packages and rebooting, the dongle should be automatically switched to modem in most of the cases. If not, continue to Step 2 below.
2) Plug in your dongle, and check output of dmesg. You should be able to find the product id and vendor id from this. Sample output below:
[ 3629.225660] usb 3-2: new high-speed USB device number 7 using xhci_hcd 
[ 3629.269215] usb 3-2: New USB device found, idVendor=19d2, idProduct=1238 
[ 3629.269223] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 
[ 3629.269227] usb 3-2: Product: ZTE WCDMA Technologies MSM 
[ 3629.269230] usb 3-2: Manufacturer: ZTE,Incorporated 
[ 3629.269233] usb 3-2: SerialNumber: MF8250ZTED000000 
[ 3629.286847] usb-storage 3-2:1.0: USB Mass Storage device detected 
[ 3629.287079] scsi10 : usb-storage 3-2:1.0 
Here the vendor id is 19d2 and product id is 1238.
3) Check contents of file /etc/usb_modeswitch.d/19d2:1238 (filename is the vendor:product) combo you observed.
If the device is listed, the file should be present, and you'll find the target id of the device (the id of the device when it acts as a modem).
Create a usb_modeswitch config file as root:
sudo gedit /etc/usb_modeswitch.conf
Paste the contents of the sample config below. Edit the vendor and device ids appropriately:
DefaultVendor=0x19d2
DefaultProduct=0x1238

TargetVendor=0x19d2
TargetProduct=0x0017

StandardEject=1
MessageEndpoint=0x01
MessageContent="5553424312345678000000000000061b000000020000000000000000000000"
#MessageContent="55534243123456782000000080000c85010101180101010101000000000000"
#MessageContent="5553424312345678000000000000061b000000030000000000000000000000" 
NeedResponse=1
4) Now run the following command:
sudo usb_modeswitch -c /etc/usb_modeswitch.conf
If all goes well, you should be able to see notification of a new device (Airtel) mounted. The Network Manager should be able to recognize the modem in Part A above (Give it a few seconds after running the above command). But before we rush there, go through Part C below for the correct ppp config.

Part C : ppp config using wvdial

1) Install wvdial
sudo apt-get install wvdial
2) Open wvdial config as root:
sudo gedit /etc/wvdial.conf
And paste the sample config below:
[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=1,"IP","airtelgprs.com"
Password = pass
Ask Password = 0
New PPPD = yes
Phone = *99#
Idle Seconds = 0
Modem Type = Analog Modem
Stupid Mode = 1
Compuserve = 0
Baud = 9600
Auto DNS = 0
Dial Command = ATDT
Modem = /dev/ttyUSB1
ISDN = 0
Username = user
3) Now run wvdialconf command to auto detect modem attributes:
sudo wvdialconf
This will populate correct attributes in wvdial.conf file and throw out a few warnings on conflicts in ppp config.
4) Open ppp config:
sudo gedit /etc/ppp/options
If the following line is present, comment it out with a #:
#'chat -v -f /etc/ppp/chat-ztisp'
Replace following lines (or similar, you get the idea) with the Modem and Baud values generated in /etc/wvdial.conf in Step 3 above
/dev/modemttyUSB2
115200

That's it! You've made it.

Optionally, you can quickly connect from command line as:
sudo wvdial
Ideally, now that the dongle is detected, use Network Manager to connect as explained in Part A

For a quick recap, now your steps on using the dongle after a fresh boot will be:
  1. Connect the dongle, wait for green/blue light to appear.
  2. If you fall in the category where the dongle isn't automatically detected, run the usb modswitch command from Part B -> Step 3.
  3. Wait for a few seconds. If you've configured the connection using Network Manager, it will now become active in connections list. Click to connect.

Still doesn't work?

For more insight into what might be stopping the dongle from being detected or getting a stable connection, take a look at syslog after connecting the dongle, running usb modswitch etc. :
tail -f /var/log/syslog 

3 comments:

  1. Hi,

    Great article but I am still facing the continuous disconnect problem after successfully going through PART A. So I moved to PART C and my /etc/wvdial.conf file look as below after step 3

    [Dialer Defaults]
    Init1 = ATZ
    Init2 = ATQ0 V1 E1 S0=0
    Init3 = AT+CGDCONT=1,"IP","airtelgprs.com"
    Password = pass
    New PPPD = yes
    Phone = *99#
    Idle Seconds = 0
    Modem Type = Analog Modem
    Stupid Mode = 1
    Compuserve = 0
    Baud = 9600
    Auto DNS = 0
    Dial Command = ATDT
    Ask Password = 0
    ISDN = 0
    Username = user
    Modem = /dev/ttyUSB0


    I could not able to complete the step 4 of PART C as I do not find the mentioned lines in /etc/ppp/options

    chat -v -f /etc/ppp/chat-ztisp

    or

    /dev/modemttyUSB2
    115200

    Though I tried by modem and baud value below at the end of file

    /dev/ttyUSB0
    9600

    I find that I do not able to connect itself, so I removed the line added.

    So basically Iam not bale to complete step 4 of PART C.

    Is it the reason why disconnect problem still exist.

    Please help me out

    ReplyDelete
  2. Thanks for sharing, nice post!

    Đến Casanova đây là cafe san vuon dep tphcm bạn không nên bỏ qua hay bạn muốn học bài thì quán cafe thích hợp để học bài cực thú vị đấy hay quán quán cafe view đẹp tphcm bạn không nên bỏ qua hay quán cafe có đàn piano siêu lãng mạn hay casanovacafe là 1 trong quan cafe gia re bạn nên đến 1 lần, hay tổng hợp những quán quán cafe dễ thương ở sài gòn hay những quán quán cà phê nhỏ và xinh đến là mê hay những quán cafe độc đáo ở tphcm không đụng hàng hay casanova là quán quan cafe co wifi manh thích hợp để làm việc hay cà phê sang chảnh bạn nên trải nghiệm hay quán cà phê độc lạ ở sài gòn cực đẹp hay quán cafe có bánh Pizza cực ngon ăn là nghiền hay đây là quan cafe nhac acoustic o sai gon cực lãng mạn hay may dua vong giúp bé ngủ ngon hay đây là quán cafe phong cách lạ bạn nên đến hay đây là quán cafe có chỗ cho trẻ em chơi hay bạn muốn hội họp thì đây là cafe may chieu cho bạn làm việc hay cà phê phòng riêng cho làm offline làm việc hay điểm danh ca phe thu cung bạn nên đến hay cafe bói bài tarot cực thú vị.

    ReplyDelete
  3. Excellence and informative post. I was looking for such post here and there but did not find anywhere. I like to read such type of blogs more. We are new online bidding service where You are guided for Fishing.

    ReplyDelete