Using a 3G modem with Linux
Recently we had to test a Telstra Sierra Aircard 310U on linux
We inserted the USB card into the linux server running 2.6.18-128 CentOS
We run "lsusb" to get the device information.
[root@server peers]# lsusb
Bus 003 Device 001: ID 0000:0000
Bus 001 Device 012: ID 1199:0fff Sierra Wireless, Inc.
Bus 001 Device 001: ID 0000:0000
Bus 004 Device 001: ID 0000:0000
Bus 005 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
We they ran usb_modeswitch using the Vendor and Product ID from lsmod, to switch the device to modem mode.
See "usb_modeswitch -h" for help. "-S" is for Sierra modem, there is "-H" Huawei and more. "-W" is verbose
[root@server]#usb_modeswitch -v 1199 -p 0fff -S 1 -W
We run "lsusb" again to see that the device ID has changed
[root@server]# lsusb
Bus 003 Device 001: ID 0000:0000
Bus 001 Device 009: ID 1199:68a3 Sierra Wireless, Inc.
Bus 001 Device 001: ID 0000:0000
Bus 001 Device 003: ID 0bc2:2000 Seagate RSS LLC Storage Adapter V3 (TPP)
Bus 004 Device 001: ID 0000:0000
Bus 005 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Now we need to add the usbserial module to the kernel.
You may have to run "modprode -r usbserial"
[root@server]# modprobe usbserial vendor=0x1199 product=0x68a3
We should now see that the USB devices have been created.
[root@server]# ls -l /dev/ttyUSB*
crw-rw---- 1 root uucp 188, 0 Apr 14 12:20 /dev/ttyUSB0
crw-rw---- 1 root uucp 188, 1 Apr 14 12:20 /dev/ttyUSB1
crw-rw---- 1 root uucp 188, 2 Apr 14 12:20 /dev/ttyUSB2
crw-rw---- 1 root uucp 188, 3 Apr 14 12:20 /dev/ttyUSB3
crw-rw---- 1 root uucp 188, 4 Apr 14 12:20 /dev/ttyUSB4
We now need to deteremine which device node is the actual modem. For this we can just guess or run "cu -l /dev/ttyUSB0 dir", then see if we can type AT commands.
Now lets prepare the dial script, so we edit /etc/wvdial.conf in vi or nano
[Dialer Defaults]
Modem = /dev/ttyUSB2
Modem Type = Analog Modem
ISDN = 0
Baud = 460800
Dial Attempts = 1
Username = user
Password = pass
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=1,"IP","telstra.internet"
Phone = *99#
Stupid Mode = 1
Now all we do is Dial and we should see. We use the name of the connection to dial, ours is "Defaults"
[root@mail]# wvdial Defaults
--> WvDial: Internet dialer version 1.54.0
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: AT&F &D2 &C1
AT&F &D2 &C1OK
--> 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","telstra.internet"
AT+CGDCONT=1,"IP","telstra.internet"
OK
--> Modem initialized.
--> Sending: ATDT*99#
--> Waiting for carrier.
ATDT*99#
CONNECT 21000000
--> Carrier detected. Starting PPP immediately.
--> Starting pppd at Thu Apr 14 12:50:54 2011
--> pid of pppd: 29229
--> Using interface ppp0
--> local IP address 10.230.53.244
--> remote IP address 10.64.64.64
--> primary DNS address 139.130.4.4
--> secondary DNS address 203.50.2.71
We can use "Ctrl-C" to terminate the session