OpenWrt Forum Archive

Topic: HOWTO: HSPA on a WRT54G3G with Kamikaze 8.09

The content of this topic has been archived on 20 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,
After some struggling and finally getting Kamikaze working on a 8.09 I've decided to create the following HOWTO for reference.

1. Assuming you are still running the stock linksys firmware, download kamikaze from the openwrt website for your version of the wrt54g3g.

http://downloads.openwrt.org/kamikaze/8 … uashfs.bin
http://downloads.openwrt.org/kamikaze/8 … uashfs.bin

2. Installation can be done using the firmware upgrade web page provided by the linksys stock firmware.

3. If you are upgrading from a previous or different build of openwrt then you can use the openwrt upgrade webpage with the following file:

http://downloads.openwrt.org/kamikaze/8 … uashfs.trx

*.bin files and *.trx files contain pretty much the same information apart from an additional header in *.bin which contains versioning and model information.

4. DO NOT INTERRUPT THE INSTALLATION PROCEDURE. Doing so may brick your router and the only way of getting around that would be a hardware modification in the form of a JTAG cable. DO NO INSTALL VIA THE WIRELESS LINK. Use one of the LAN (not WAN) ports on the back of the WRT54G3G).

5. If the installation has been a success, try to connect to your router using the following command "telnet 192.168.1.1". You should see the openwrt welcome screen and the command prompt:

BusyBox v1.11.2 (2009-01-06 07:18:07 CET) built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __
|       |.-----.-----.-----.|  |  |  |.----.|  |_
|   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
|_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
KAMIKAZE (8.09, r14511) ----------------------------
  * 10 oz Vodka       Shake well with ice and strain
  * 10 oz Triple sec  mixture into 10 shot glasses.
  * 10 oz lime juice  Salute!
---------------------------------------------------
root@OpenWrt:~#

...it's good practice to set the root password at this point. It can be done using the "passwd" command. After this, it'll only be possible to log in using "ssh 192.168.1.1"

6. At this point you will not have the necessary packages or network modules to detect your UMTS/3G card or to connect to the internet. You will need to provide internet connectivity to the WRT54G3G using the WAN port. This can be done from and ADSL, modem, etc...

7. The default openwrt configuration will have an interface configured called "wan". This can be used to configure the WAN port/interface for network connectivity. This should usually work out of the box (DHCP is enabled), but if tinkering is needed the following section in "/etc/config/network" can be edited:

config 'interface' 'wan'     
        option 'ifname' 'eth0.1'
        option 'macaddr' ''   
        option 'ip6addr' ''       
        option 'ip6gw' ''           
        option 'dns' ''
        option 'gateway' ''
        option 'proto' 'dhcp'
        option 'ipaddr' ''     
        option 'netmask' '' 

...using the "vi /etc/config/network" command. The usage of vi is considered outside the scope of this HOWTO and it is assumed the reader is familiar with it.

8. Test the internet connectivity by pinging an outside host (e.g. ping www.cnn.com).
9. Once internet via the WAN port has been verified to work, it is time to update openwrt to get the latest list of packages. Openwrt uses a package manager called "opkg" which is similar to the popular "apt" package manager from debian.

Execute "opkg update". The following should appear:

Downloading http://downloads.openwrt.org/kamikaze/8 … ackages.gz
Connecting to downloads.openwrt.org (195.56.146.238:80)
Packages.gz          100% |*******************************************************************************************************|   132k 00:00:00 ETA
Inflating http://downloads.openwrt.org/kamikaze/8 … ackages.gz
Updated list of available packages in /var/opkg-lists/snapshots


10. Next we will install the necessary packages and kernel modules required to make our UMTS modem work. In my case it was a Option GE0301 (Etna) express card using a PCMCIA adaptor. Note that the adaptor does make a difference and not all adaptors works with all cards (e.g. I have a HUWAEI branded adaptor that doesn't work with this card but the Option branded one does).

Execute the following commands:

root@OpenWrt:~# opkg install pcmcia-cs
Installing pcmcia-cs (3.2.8-1) to root...
Configuring pcmcia-cs
Done.
root@OpenWrt:~# opkg install kmod-pcmcia-core
Installing kmod-pcmcia-core (2.4.34-brcm-1) to root...
Configuring kmod-pcmcia-core
Done.

11. We should now have everything we need to detect the UMTS/3G card. If it is not yet plugged in, plug it in. The lights on the card should light up after about 1-2 seconds. Execute the following command to verify that the card has been detected by openwrt:

root@OpenWrt:~# cardctl status
Socket 0:
  3.3V CardBus card
  function 0: [ready]


12. Next we will install the kernel modules required to use the card for network connectivity:

root@OpenWrt:~# opkg install kmod-usb-core
Installing kmod-usb-core (2.4.34-brcm-1) to root...
Configuring kmod-usb-core
Done.
root@OpenWrt:~# opkg install kmod-usb-serial
Installing kmod-usb-serial (2.4.34-brcm-1) to root...
Configuring kmod-usb-serial
Done.
root@OpenWrt:~# opkg install kmod-usb-ohci
Installing kmod-usb-ohci (2.4.34-brcm-1) to root...
Configuring kmod-usb-ohci
Done.
root@OpenWrt:~#

13. At this point the odds are the kernel modules (specifically usb-serial) would not have detected the USB ports on your UMTS card correctly. This is due to the stock kernel 2.4 being used for this version of openwrt. While there is a newer 2.6 kernel version of openwrt available, it does not yet handle pcmcia and wirelessly correctly on the WRT54G3G. You will see the following in the openwrt log if you execute the "logread" command:

usb.c: USB device 2 (vend/prod 0x0af0/0x7001) is not claimed by any active driver.


14. To fix this we edit the "/etc/modules.d/60-usb-serial" file so that the single "usbserial" line is changed to:

usbserial vendor=0x0af0 product=0x7001 maxSize=4096 #Option GE0301

15. Executing "rmmod usbserial;insmod usbserial" or simply rebooting the router will now show the following in the logs to indicate that the modem USB ports have been correctly assigned to devices. Specifically we are looking for the following lines:

usbserial.c: Generic converter detected
usbserial.c: Generic converter now attached to ttyUSB0 (or usb/tts/0 for devfs)
usbserial.c: Generic converter detected
usbserial.c: Generic converter now attached to ttyUSB1 (or usb/tts/1 for devfs)
usbserial.c: Generic converter detected
usbserial.c: Generic converter now attached to ttyUSB2 (or usb/tts/2 for devfs)

The Option GE0301 will use the first USB port ( ttyUSB0) for actual UMTS connectivity. ttyUSB1 and ttyUSB2 are used for auxiliary functions like checking signal strength, etc.

16. Next we will install comgt:

root@OpenWrt:~# opkg install comgt
Installing comgt (0.32-1) to root...
Configuring comgt
Done.


17. Now we will configure the openwrt interfaces for our UMTS connection. Edit the "/etc/config/network" file and change the "wan" section to show the following. In my case I am with the ERA provider in Poland. (Those options that are set to '' can safely be ignored):

config 'interface' 'wan'   
        option 'ifname' 'ppp0'
        option 'device' '/dev/usb/tts/0'
        option 'proto' '3g'
        option 'macaddr' ''
        option 'peerdns' 0           
        option 'pincode' ''
        option 'service' 'umts_only'
        option 'country' 'uk'   
        option 'apn' 'eradata'
        option 'username' 'erainternet'
        option 'password' 'xxxxxxxxx'
        option 'vpi' ''                           
        option 'vci' ''   
        option 'mtu' ''     
        option 'keepalive' ''
        option 'defaultroute' '1'
        option 'ppp_redial' 'persist'
        option 'ipaddr' ''
        option 'ip6addr' ''   
        option 'netmask' ''             
        option 'gateway' ''
        option 'ip6gw' '' 

Various other guides have indicated that you can simply create a new interface called 3G or ppp0. This is indeed true, but the implication is that you will need to update the "/etc/config/firewall" file to make sure port forwarding,etc is correctly working. Here is a snippet of the standard "/etc/config/firewall" that ships with openwrt:

onfig defaults
        option syn_flood        1
        option input            ACCEPT
        option output           ACCEPT
        option forward          REJECT

config zone
        option name             lan
        option input    ACCEPT
        option output   ACCEPT
        option forward  REJECT

config zone
        option name             wan
        option input    REJECT
        option output   ACCEPT
        option forward  REJECT
        option masq             1

config forwarding
        option src      lan
        option dest     wan
        option mtu_fix  1

18. If you are using the PIN on your simcard you'll need to set it by adding the following line to the "wan" section of the "/etc/config/network" file:

option pincode      'mypincode'


19. Next we'll execute the "ifup wan" to see if the card connects to our provider:

root@OpenWrt:~# ifup wan
SIM ready
PIN set successfully
Trying to set mode

We specifically want to see the following in the logs:

Jan  1 01:01:05 OpenWrt daemon.notice pppd[625]: pppd 2.4.3 started by root, uid 0
Jan  1 01:01:06 OpenWrt local2.info chat[628]: abort on (BUSY)
Jan  1 01:01:06 OpenWrt local2.info chat[628]: abort on (NO CARRIER)
Jan  1 01:01:06 OpenWrt local2.info chat[628]: abort on (ERROR)
Jan  1 01:01:06 OpenWrt local2.info chat[628]: report (CONNECT)
Jan  1 01:01:06 OpenWrt local2.info chat[628]: timeout set to 10 seconds
Jan  1 01:01:06 OpenWrt local2.info chat[628]: send (AT&F^M)
Jan  1 01:01:06 OpenWrt local2.info chat[628]: expect (OK)
Jan  1 01:01:06 OpenWrt local2.info chat[628]: AT&F^M^M
Jan  1 01:01:06 OpenWrt local2.info chat[628]: OK
Jan  1 01:01:06 OpenWrt local2.info chat[628]:  -- got it
Jan  1 01:01:06 OpenWrt local2.info chat[628]: send (ATE1^M)
Jan  1 01:01:07 OpenWrt local2.info chat[628]: expect (OK)
Jan  1 01:01:07 OpenWrt local2.info chat[628]: ^M
Jan  1 01:01:07 OpenWrt local2.info chat[628]: ATE1^M^M
Jan  1 01:01:07 OpenWrt local2.info chat[628]: OK
Jan  1 01:01:07 OpenWrt local2.info chat[628]:  -- got it
Jan  1 01:01:07 OpenWrt local2.info chat[628]: send (AT+CGDCONT=1,"IP","eradata"^M)
Jan  1 01:01:07 OpenWrt local2.info chat[628]: timeout set to 30 seconds
Jan  1 01:01:07 OpenWrt local2.info chat[628]: expect (OK)
Jan  1 01:01:07 OpenWrt local2.info chat[628]: ^M
Jan  1 01:01:07 OpenWrt local2.info chat[628]: AT+CGDCONT=1,"IP","eradata"^M^M
Jan  1 01:01:07 OpenWrt local2.info chat[628]: OK
Jan  1 01:01:07 OpenWrt local2.info chat[628]:  -- got it
Jan  1 01:01:07 OpenWrt local2.info chat[628]: send (ATD*99***1#^M)
Jan  1 01:01:07 OpenWrt local2.info chat[628]: expect (CONNECT)
Jan  1 01:01:07 OpenWrt local2.info chat[628]: ^M
Jan  1 01:01:07 OpenWrt local2.info chat[628]: ATD*99***1#^M^M
Jan  1 01:01:07 OpenWrt local2.info chat[628]: CONNECT
Jan  1 01:01:07 OpenWrt local2.info chat[628]:  -- got it
Jan  1 01:01:07 OpenWrt local2.info chat[628]: send ( ^M)
Jan  1 01:01:07 OpenWrt daemon.info pppd[625]: Serial connection established.
Jan  1 01:01:08 OpenWrt daemon.info pppd[625]: Using interface ppp0
Jan  1 01:01:08 OpenWrt daemon.notice pppd[625]: Connect: ppp0 <--> /dev/usb/tts/0
Jan  1 01:01:09 OpenWrt daemon.info pppd[625]: CHAP authentication succeeded
Jan  1 01:01:09 OpenWrt daemon.notice pppd[625]: CHAP authentication succeeded
Jan  1 01:01:12 OpenWrt daemon.warn pppd[625]: Could not determine remote IP address: defaulting to 10.64.64.64
Jan  1 01:01:12 OpenWrt daemon.notice pppd[625]: local  IP address XX.XXX.XXX.XXX
Jan  1 01:01:12 OpenWrt daemon.notice pppd[625]: remote IP address 10.64.64.64


20. One of the issues I've had with my combination of UMTS modem, provider and router is that my DNS settings are not correctly obtained from (as they should be) at connection time. Openwrt uses a program called dnsmasq that will normally pick these up, and write them to "/tmp/resolv.conf.auto".

If you have the same problem and need to "hardcode" them, edit the "/etc/init.d/dnsmasq" file and replace the line that says:

DNS_SERVER=""

with:

DNS_SERVER="mydnsserver1 mydnsserver2"

...where "mydnsserver1 mydnsserver2" should be replaced with the desired DNS servers to be used (can be obtained from your provider). Restart dnsmasq by issuing "/etc/init.d/dnsmasq restart"

Additionally, create the following file in "/etc/ppp/ip-up.d/nameserver.sh"

#!/bin/sh

rm /tmp/resolv.conf.auto
echo "nameserver mydnsserver1">>/tmp/resolv.conf.auto
echo "nameserver mydnsserver2">>/tmp/resolv.conf.auto
chmod 777 /tmp/resolv.conf.auto

This will set the correct DNS entries every time you connect. Execute the "chmod 777 /etc/ppp/ip-up.d/nameserver.sh" to make sure it can be executed.

21. Right now, if you issue a "ifdown wan" and another "ifup wan" you should be able to connect via your WRT54G3G to the internet.

22(optional). Due to us running on kernel 2.4 - there may still be a slight performance hit due to the implementation of the "usbserial" kernel module. If you have set the maxSize module parameter in step 14, then following steps 22 through to 26 should be ignored. The possible speed implication can be overcome by patching the said module or installing a patched version that has been kindly provided for Kamikaze 8.09 by "plastinka". Before using it, please make sure that your openwrt kernel version is 2.4.35.4. You can check this by issuing:

root@OpenWrt:~# cat /proc/version
Linux version 2.4.35.4 (nbd@baustelle) (gcc version 3.4.6 (OpenWrt-2.0)) #51 Sat Feb 14 23:44:13 CET 2009


23(optional). Down the patched usbserial files from "http://caiowa.ca.funpic.de/Blog/wp-cont … mobile.zip". (It is actually a rar file - renaming it usb-mobile.rar will do the trick). Copy it to your router using scp.

24(optional). Once extracted, the usb-mobile.zip file will contain the following:

60-usb-serial 
70-usb-mobile 
usbmobile.o   
usbserial.o

First we will back up the existing files (in case something goes wrong we can revert to them):

cp /etc/modules.d/60-usb-serial /etc/modules.d/60-usb-serial.backup
cp /lib/modules/2.4.35.4/usbserial.o /lib/modules/2.4.35.4/usbserial.o.backup

Next we will copy the new versions in place:

cp usb-mobile/60-usb-serial /etc/modules.d/
cp usb-mobile/70-usb-mobile /etc/modules.d/
cp usb-mobile/usbserial.o /lib/modules/2.4.35.4/
cp usb-mobile/usbmobile.o /lib/modules/2.4.35.4/

25(optional). We will also need to update the /etc/modules.d/70-usb-mobile file with our UMTS card information as before (it is not longer in 60-usb-serial):

usbmobile vendor=0xaf0 product=0x7001 # Option GE0301

...and execute a "rmmod usbserial;insmod usbserial;insmod usbmobile" or restart the router to see the changes.

26(optional). Logread should now show that we have a new module called usbmobile loaded that is tuned for UMTS devices:

Jan  1 00:00:23 kernel: usb.c: new USB bus registered, assigned bus number 2
Jan  1 00:00:23 kernel: hub.c: USB hub found
Jan  1 00:00:23 kernel: hub.c: 2 ports detected
Jan  1 00:00:24 kernel: usb.c: registered new driver serial
Jan  1 00:00:24 kernel: usbserial.c: USB Serial support registered for Generic
Jan  1 00:00:24 kernel: usbserial.c: USB Serial Driver core v1.4
Jan  1 00:00:24 kernel: usbserial.c: USB Serial support registered for Mobile
Jan  1 00:00:24 kernel: usbmobile.c: USB serial driver tuned for mobile datacard devices v0.01
Jan  1 01:00:25 kernel: hub.c: new USB device 02:00.0-1, assigned address 2
Jan  1 01:00:25 kernel: usbserial.c: Mobile converter detected
Jan  1 01:00:25 kernel: usbserial.c: Mobile device has good endpoints
Jan  1 01:00:25 kernel: KERNEL DEBUG => USBSERIAL.O buffer_size = 4096usbmobile.c: Vendor = 0x0af0, Product = 0x7001, 7 write urbs with buffers of 1536 bytes
Jan  1 01:00:25 kernel: usbserial.c: Mobile converter now attached to ttyUSB0 (or usb/tts/0 for devfs)
Jan  1 01:00:25 kernel: usbserial.c: Mobile converter now attached to ttyUSB1 (or usb/tts/1 for devfs)
Jan  1 01:00:25 kernel: usbserial.c: Mobile converter detected
Jan  1 01:00:25 kernel: usbserial.c: Mobile device has good endpoints
Jan  1 01:00:25 kernel: KERNEL DEBUG => USBSERIAL.O buffer_size = 4096<6>usbserial.c: Mobile converter now attached to ttyUSB2 (or usb/tts/2 for devfs)
Jan  1 01:00:25 kernel: usbserial.c: Mobile converter now attached to ttyUSB3 (or usb/tts/3 for devfs)
Jan  1 01:00:25 kernel: usbserial.c: Mobile converter detected
Jan  1 01:00:25 kernel: usbserial.c: Mobile device has good endpoints
Jan  1 01:00:25 kernel: KERNEL DEBUG => USBSERIAL.O buffer_size = 4096<6>usbserial.c: Mobile converter now attached to ttyUSB4 (or usb/tts/4 for devfs)
Jan  1 01:00:25 kernel: usbserial.c: Mobile converter now attached to ttyUSB5 (or usb/tts/5 for devfs)


27. Executing a "ifup wan" will now get us online and at full speed. The only negative effects to far has been the following appearing in the logs (but connectivity remains okay):

Jan  1 01:01:15 OpenWrt user.notice root: adding wan (ppp0) to firewall zone wan
Jan  1 01:01:15 kernel: hub.c: new USB device 02:00.0-2, assigned address 3
Jan  1 01:01:15 kernel: usb.c: USB device not accepting new address=3 (error=-145)
Jan  1 01:01:16 OpenWrt user.notice root: starting ntpclient
Jan  1 01:01:16 kernel: hub.c: Cannot enable port 2 of hub 1, disabling port.
Jan  1 01:01:16 kernel: hub.c: Maybe the USB cable is bad?
Apr 26 10:02:11 OpenWrt daemon.info pppd[625]: System time change detected.
Apr 26 10:02:12 kernel: hub.c: new USB device 02:00.0-2, assigned address 4
Apr 26 10:02:12 kernel: usb.c: USB device not accepting new address=4 (error=-145)
Apr 26 10:02:12 kernel: hub.c: new USB device 02:00.0-2, assigned address 5
Apr 26 10:02:12 kernel: usb.c: USB device not accepting new address=5 (error=-145)


28. This guide has been compiled using various posts on the openwrt forums and the following external blogs. Many thanks to the original authors:

http://forum.openwrt.org/viewtopic.php?id=19631
http://josefsson.org/grisslan/internet.html
http://caiowa.ca.funpic.de/Blog/

(Last edited by milmber on 26 Apr 2009, 13:30)

This is a great HOWTO.

All I would add:

I seem to have the same card as you but in step 14 where you have:
   usbserial vendor=0x0af0 product=0x7001 maxSize=4096 #Option GE0301
this didn't work for me, the vendor id for me is 0xaf0., note no 0 before the a. You have 0xaf0 in step 25.

On vodafone UK the APN is internet, the username is web and you can guess the three-character password.

EDIT: Also I spent about 20 minutes trying to work out if I should install the -em variant. If anyone else is confused by this look for the current Linksys firmware version in the web administration pages and if it has -em there, you should use -em, if it doesn't you shouldn't. At least that worked for me.

Thank you! Going to configure my wireless now.

(Last edited by sydb on 31 May 2009, 00:16)

First of all thanks for this great and simple to follow How To!

Regarding step 20 and the problem with getting the correct DNS entries I have found a solution which works at least with Vodafone Germany:

Edit "/etc/ppp/options" and add the following line:

        ipcp-max-failure 15

I hope this works for you also...

Best regards, Arnd

(Last edited by arnd on 2 Jul 2009, 09:01)

Thanks a ton for the comprehensive tutorial. Just a quick question: will this install enable me to keep track of the exact amount of (daily/monthly) gigabytes that have been used through the UMTS connection? (I've heard it's possible for the WAN via SNMP - just not sure about UMTS).

Thanks again!

Quick note that the original HOWTO works on Backfire 10.03.1-rc4. The only caveat is that 'insmod ds' should be executed in order to detect the PCMCIA slot. This can be made permanent by adding a relevant entry to '/etc/modules/'.....

Thank you for this how-to. I tested with backfire 10.3.1 and it works perfectly. I used a Sierra Wireless Aircard 881 modem, and the only difference is that I had to install the module kmod-usb-serial-sierrawireless.

The discussion might have continued from here.