Using a 3G USB Modem
Notes for 3G USB Modem set up on TP Link Routers
NOTE: This approach is now superseded to some extent with the inclusion of USB Modem WAN configuration in SECN 2.0 firmware. It is still useful for setting up a device from scratch.
The following is a brief HowTo on setting up a 3G USB modem for use with the TP-Link devices such as the MR3020 and WR703. The process should also be applicable to other USB equipped devices.
Tested on OpenWrt Attitude Adjustment 12.09 Stable release with Sierra Wireless USB308, Huawei E220 and E173 modems.
Note that the modeswitch and kmod-usb-serial packages have been further developed since the stable AA release and so the process will be somewhat different for the development trunk and later releases.
1. Install OpenWrt Firmware e.g. this was tested on Attitude Adjustment 12.09
Download the appropriate firmware image from OpenWrt Downloads e.g.
Reboot the device and connect at default address of 192.168.1.1
2. Install additional packages (if not already in the firmware image)
# opkg update # opkg install comgt # opkg install kmod-usb-serial # opkg install kmod-usb-serial-option # opkg install kmod-usb-serial-wwan # opkg install usb-modeswitch # opkg install usb-modeswitch-data # opkg install luci-proto-3g # This is for 3G device configuration support in Luci # opkg install openssh-sftp-server # This is for file browsing if required
3. Find out Vendor and Product codes for the particular 3G device.
Plug the USB device in, wait for it to be found, and check:
# cat /proc/bus/usb/devices
Output should look something like this:
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 4 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1199 ProdID=68a3 Rev= 0.06 S: Manufacturer=Sierra Wireless, Incorporated S: Product=USB 308 S: SerialNumber=352921041065583
For a Sierra USB308: Vendor=1199 ProdID=68a3
For a Huawei E220: Vendor=12d1 ProdID=1003
For a Huawei E173: Vendor=12d1 ProdID=14a8
4. Configure this in /etc/modules.d/60-usb-serial.
# vi /etc/modules.d/60-usb-serial
and edit first line to add codes:
usbserial vendor=0x1199 product=0x68a3
Reboot to apply
5. Check that serial ports show up:
# ls /dev/ttyUSB*
Now typically ttyUSB0-ttyUSB4 should show up.
6. Figure out which is the correct serial port for the modem.
Often it is the lowest number but varies with different devices. Run logread and dmesg and look for the interface that has an interrupt listed. Google is also your friend. As a last resort, try configuring for each one in turn.
7. Modify chat script
Modify chat script in /etc/chatscripts/3g.chat to use the correct dial string (eg *99#) as specified by the vendor.
You can also enter the APN here, or let the script get it from the config file
8. Set up network config
Edit /etc/config/network to include the wan/3g interface. Where /dev/ttyUSBx is the modem serial port
config interface wan option ifname ppp0 option pincode '' option device /dev/ttyUSBx # Serial port for the modem option apn telstra.internet # APN for the 3G service option service umts option proto 3g
9. Reboot to apply.
The device should power up and the modem connect to the carrier.
10. To check signal strength run:
# gcom -d /dev/ttyUSBy (where y is the appropriate tty port number)
11. A PC attached to the Ethernet port should be able to access the internet through the modem.
Note that DHCP will be running by default on the unit, so the connected PC will be assigned an IP address.