User Tools

Site Tools


doc:recipes:3gdongle

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
doc:recipes:3gdongle [2012/12/08 22:49]
ajo
doc:recipes:3gdongle [2014/10/19 15:09] (current)
epek
Line 2: Line 2:
  
 | FIXME: REDUNDANT with [[doc/​howto/​wired.wan.with.3g.dongle]] | | FIXME: REDUNDANT with [[doc/​howto/​wired.wan.with.3g.dongle]] |
-| FIXME: Is the kmod-usb-serial-option really needed? | 
  
 This recipe explains how to setup and configure OpenWrt for using a USB 3g/​UMTS-modem for WAN connection. You may want to checkout the ''​[[doc:​uci:​multiwan]]''​ package to use this simultaneously with other connections to the internet. This recipe explains how to setup and configure OpenWrt for using a USB 3g/​UMTS-modem for WAN connection. You may want to checkout the ''​[[doc:​uci:​multiwan]]''​ package to use this simultaneously with other connections to the internet.
Line 14: Line 13:
  
 :!: If you have the Leadtek FlashOFDM card (Flarion) from T-Mobile in Slovakia and the Asus WL-500g Premium, you may use the image on [[http://​www.accalio.com/​index.php?​id=301]]. If you wish to get more information,​ or another distribution with the driver, please contact Accalio [[http://​www.accalio.com]] :!: If you have the Leadtek FlashOFDM card (Flarion) from T-Mobile in Slovakia and the Asus WL-500g Premium, you may use the image on [[http://​www.accalio.com/​index.php?​id=301]]. If you wish to get more information,​ or another distribution with the driver, please contact Accalio [[http://​www.accalio.com]]
 +
 +:!: You | FIXME: need not | must not install **usb-modeswitch** onto your wrt device if you cure your 3g-usb modem from the so called **'​NO-CD'​** feature. Plug it into a desktop PC with usb-modeswitch and have a look at [[http://​www.3g-modem-wiki.com/​page/​Huawei+AT-commands]]. I was able to fix 3 modems with **a simple AT-command**. Plugged in, they just show up the serial lines (ttyUSB0-2) and the sd-card reader. Very nice!
 +
 +:!: Some sticks provide an usb-ethernet-device. (E.g. E303) In that case usb-modeswitch and [[doc:​howto:​usb.tethering|usb tethering]] will help.
 +
 +:!: Some high speed usb modems provide **qmi** or **mbim** protocol for connection instead of legacy ppp protocol. For more information about qmi and mbim, see [[#​Devices.using.qmi.and.mbim.protocol|Devices using qmi and mbim protocol]] section of this wiki.
  
 ===== Preparations ===== ===== Preparations =====
 ==== Required Packages ==== ==== Required Packages ====
 First install required packages: First install required packages:
-  *//comgt// [[http://linux.die.net/man/1/​comgt|manpage for comgt]]+  *//comgt// [[http://dev.man-online.org/man1/comgt/|manpage for comgt]]
   *Appropriate host controller interface for your USB hardware (precompiled images will most likely already contain the correct one)   *Appropriate host controller interface for your USB hardware (precompiled images will most likely already contain the correct one)
     *//​kmod-usb2//​ (aka EHCI)     *//​kmod-usb2//​ (aka EHCI)
Line 31: Line 36:
   *modeswitching tools, if your modem initially presents itself as a storage device - one of the following, depending on your modem:   *modeswitching tools, if your modem initially presents itself as a storage device - one of the following, depending on your modem:
     *//​usb-modeswitch//​ and //​usb-modeswitch-data//​ (//​recommended//​) A mode switching tool for controlling "flip flop" (multiple device) USB gear.     *//​usb-modeswitch//​ and //​usb-modeswitch-data//​ (//​recommended//​) A mode switching tool for controlling "flip flop" (multiple device) USB gear.
 +
 +Note: as of [[https://​dev.openwrt.org/​changeset/​36812|r36812]],​ usb-modeswitch package ​ had been under major overhaul from ordinary draisberghof usb_modeswitch found in many linux distributions. **usb-modeswitch-data is included in the package**, with the new json format.
     *//sdparm// - utility to send SCSI commands (needed on Ovation MC935D)     *//sdparm// - utility to send SCSI commands (needed on Ovation MC935D)
   * //​luci-proto-3g//​ for proper support in luci in RC6 and later   * //​luci-proto-3g//​ for proper support in luci in RC6 and later
Line 43: Line 50:
  
 ===== Installation ===== ===== Installation =====
 +First install needed packages:
 +<​code>​
 +opkg update
 +opkg install comgt kmod-usb-serial kmod-usb-serial-option kmod-usb-serial-wwan usb-modeswitch usb-modeswitch-data
 +</​code>​
 +
 Now plug your USB Dongle to the USB port and restart the router. Now plug your USB Dongle to the USB port and restart the router.
  
Line 80: Line 93:
 insmod /​lib/​modules/​`uname -r`/​usbserial.ko vendor=0x<​vid>​ product=0x<​pid>​ insmod /​lib/​modules/​`uname -r`/​usbserial.ko vendor=0x<​vid>​ product=0x<​pid>​
 </​code>​ </​code>​
 +Alternatively,​ you can also use option GSM driver on your dongle. Option driver is more reliable, as it can distinguish between serial port and storage port.
 +<​code>​
 +insmod option #skip this if option driver is loaded already
 +echo '<​vid>​ <pid> ff' > /​sys/​bus/​usb-serial/​drivers/​option1/​new_id
 +</​code>​
 +
 +To automate the process of attaching option serial driver on boot, just edit ''/​etc/​rc.local''​ and place
 +<​code>​
 +echo '<​vid>​ <pid> ff' > /​sys/​bus/​usb-serial/​drivers/​option1/​new_id
 +</​code>​
 +before the exit code
 +<​code>​
 +exit 0
 +</​code>​
 +
 +Adding the above to hotplug instead of rc.local:
 +You can easily integrate this into hotplug in the following way - in this example we will use a fictional "3G Dongie HSPA+" Dongle:
 +
 +
 +Create and edit the file /​etc/​hotplug.d/​usb/​22-dongie_hspaplus:​
 +<​code>​
 +#​!/​bin/​sh ​                                                                      
 +...
 +                                                                                ​
 +DONGIEHSPAPLUS_PRODID="​0815/​9000/​0" ​                                               ​
 +if [ "​${PRODUCT}"​ = "​${DONGIEHSPAPLUS_PRODID}"​ ]; then                             
 +        if [ "​${ACTION}"​ = "​add"​ ]; then                           
 +...             
 +                echo '0815 9000 ff' > /​sys/​bus/​usb-serial/​drivers/​option1/​new_id
 +...
 +</​code>​
 +
 +If your modem'​s switched product id is 0815:9000, the above will work.
 +So for your modem you will have to replace all appearances of the variable DONGIEHSPAPLUS_PRODID and all appearance of "​0815"​ and "​9000"​ in the above example with your matching product'​s name, vendor and product id.
  
 Check dmesg again for: Check dmesg again for:
Line 91: Line 138:
 usbcore: registered new interface driver usbserial_generic usbcore: registered new interface driver usbserial_generic
 usbserial: USB Serial Driver core usbserial: USB Serial Driver core
 +</​code>​
 +Also check kernel USB debug for loaded drivers
 +<​code>​
 +root@OpenWrt:​~#​ cat /​sys/​kernel/​debug/​usb/​devices
 +
 +T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  3 Spd=480 ​ MxCh= 0
 +D:  Ver= 2.00 Cls=00(>​ifc ) Sub=00 Prot=00 MxPS=64 #​Cfgs= ​ 1
 +P:  Vendor=1c9e ProdID=9800 Rev= 0.00
 +S:  Manufacturer=USB Modem
 +S:  Product=USB Modem
 +S:  SerialNumber=1234567890ABCDEF
 +C:* #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA
 +I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
 +E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
 +E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
 +I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
 +E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
 +E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
 +E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
 +I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
 +E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
 +E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
 +I:* If#= 3 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
 +E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
 +E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
 </​code>​ </​code>​
  
Line 99: Line 171:
  
 Now your USB Dongle should create logs in dmesg. If it doesn'​t,​ try <​code>​usb_modeswitch -c /​etc/​usb_modeswitch.d/<​file></​code>​ where ''<​file>''​ represents the modem'​s combined vendor/​product id, e.g. 19d2:0083 for a ZTE MF190. Obviously, that file must exist in the forementioned directory. Now your USB Dongle should create logs in dmesg. If it doesn'​t,​ try <​code>​usb_modeswitch -c /​etc/​usb_modeswitch.d/<​file></​code>​ where ''<​file>''​ represents the modem'​s combined vendor/​product id, e.g. 19d2:0083 for a ZTE MF190. Obviously, that file must exist in the forementioned directory.
 +
 +For instance, with the DX 7.2M HSDPA 3G SIM Card USB Item# 80032, the reported scsi ID is 12d1:1001; running "​usb_modeswitch ​ -v 12d1 -p 1001" results in 4 ttyUSB devices:
 +<​code>​
 +[426955.836000] option 1-1.2:1.0: GSM modem (1-port) converter detected
 +[426955.844000] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB0
 +[426955.860000] option 1-1.2:1.1: GSM modem (1-port) converter detected
 +[426955.868000] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB1
 +[426955.884000] option 1-1.2:1.2: GSM modem (1-port) converter detected
 +[426955.892000] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB2
 +[426955.908000] option 1-1.2:1.3: GSM modem (1-port) converter detected
 +[426955.916000] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB3
 +[426955.936000] scsi17 : usb-storage 1-1.2:1.4
 +[426956.940000] scsi 17:0:0:0: CD-ROM ​           HSDPA    CDROM Storage ​   2.31PQ: 0 ANSI: 2
 +[426956.948000] scsi 17:0:0:0: Attached scsi generic sg0 type 5
 +[426956.960000] scsi 17:0:0:1: Direct-Access ​    ​HSDPA ​   MMC Storage ​     2.31PQ: 0 ANSI: 2
 +[426956.968000] sd 17:0:0:1: Attached scsi generic sg1 type 0
 +[426956.992000] sd 17:0:0:1: [sda] Attached SCSI removable disk
 +</​code>​
 +
 +**NOTE:** As of [[https://​dev.openwrt.org/​changeset/​36812|r36812]],​ OpenWrt made significant changes with ''​usb-modeswitch''​ as part of ''​procd''​ system init daemon. The new ''​usb-modeswitch''​ package includes binary usbmode with json-based configuration instead of classic usb_modeswitch binary. Supported modems should switch automatically as long as usbmode service is active.
 +The ''/​etc/​usb-mode.json''​ configuration file looks partially like below.
 +<code json>
 +{
 + "​messages"​ : [
 + "​555342431234567800000000000006d0000000000000000000000000000000",​
 + "​5553424312345678000000000000061b004600000000000000000000000000",​
 +],
 +"​devices"​ : {
 + "​03f0:​002a":​ {
 + "​*":​ {
 + "​t_class":​ 7,
 + "​msg":​ [ 0 ],
 + "​response":​ true
 + }
 + },
 + "​0408:​f000":​ {
 + "​*":​ {
 + "​t_vendor":​ 1032,
 + "​t_product":​ [ 53257 ],
 + "​msg":​ [ 1 ]
 + }
 + },
 + }
 +}
 +</​code>​
 +
 +''​03f0:​002a''​ is default vendor and product in hexadecimal neotation, as it appears on executition of ''​lsusb''​ or kernel usb debug, while ''​msg''​ is the message content array. These messages issue the commands, that will either allow for media eject and/or eject the virtual CD-ROM, ... in order to switch the device into 3G modem mode. ''​t_vendor''​ is target vendor in decimal notation, ''​t_product''​ is target product in decimal notation. ​
 +Depending to the recognized vendor and product id, you may send one of the messages to the dongle by just using the message array index
 +If you want to know more, look at the file /​etc/​usb-mode.json.
 +
 +The above usbmode-json example will send this message code
 +<​code>​
 +"​555342431234567800000000000006d0000000000000000000000000000000"​
 +</​code>​
 +to the usb device with the vendor id **03f0** and product id **002a**. After modeswitching,​ the usb device will stay with the same vendor id and product id, but with target device class number of 7.
 +
 +In addition, it will send message code
 +<​code>​
 +"​5553424312345678000000000000061b004600000000000000000000000000"​
 +</​code>​
 +to the usb device with the vendor id and the product id of 0408:f000. After modeswitching,​ the usb device will switch to decimal vendor id and product id of 1032:53257, which you can convert to hexadecimal notation of 0408:D009 (You need decimal to hexadecimal converter such as your computer'​s calculator in '​programmer'​s mode'​.). The device vendor id and product id after modeswitch as show on //lsusb// and ''/​sys/​kernel/​debug/​usb/​devices''​ is 0408:D009.
 +
 +Note: the json file is generated automaticallly from ordinary usb_modeswitch data files during build process using perl script named ''​convert-modeswitch.pl''​.
 +For diagnostics purpose, you can create ''​usb-mode-custom.json''​ with defined message and devices part and launch the command
 +<​code>​
 +usbmode -l
 +usbmode -s -v -c /​path/​to/​usb-mode-custom.json
 +</​code>​
 +Converting the standard usb-modeswitch file to json format can be done in a simple way.
 +The standard usb-modeswitch file (0408:f000) content.
 +<code shell>
 +# Yota Router (Quanta 1QDLZZZ0ST2)
 +TargetVendor=0x0408
 +TargetProduct=0xd009
 +MessageContent="​5553424312345678000000000000061b004600000000000000000000000000"​
 +</​code>​
 +Target vendor (0x0408) is converted to decimal notation to fill //​t_vendor//​ value (1032) and target product (0xd009) is converted to decimal notation to fill //​t_product//​ (53257). There is only one message content, so the message index is zero (0). The resulting usb-mode-custom.json content is as follows.
 +<code json>
 +{
 + "​messages"​ : [
 + "​5553424312345678000000000000061b004600000000000000000000000000",​
 +],
 +"​devices"​ : {
 + "​0408:​f000":​ {
 + "​*":​ {
 + "​t_vendor":​ 1032,
 + "​t_product":​ [ 53257 ],
 + "​msg":​ [ 0 ]
 + }
 + },
 + }
 +}
 +</​code>​
 +
 +Based on this example, you can make another usb-mode-custom.json file to perform modeswitching on unsupported dongles for diagnostic purpose.
  
 If your device doesn'​t work with usb_modeswitch,​ try the sdparm method. If your device doesn'​t work with usb_modeswitch,​ try the sdparm method.
Line 119: Line 286:
 <​code>​ <​code>​
 sdparm --eject /dev/sg0 sdparm --eject /dev/sg0
 +</​code>​
 +
 +For Attitude Adjustment try:
 +<​code>​
 +sdparm --command=eject /dev/sg0
 </​code>​ </​code>​
  
Line 141: Line 313:
  
 | ''​config interface wan | ''​config interface wan
-        ​option ifname ​ ppp0+#        ​option ifname ​ ppp0 # on some carriers enable this line
         option pincode 1234         option pincode 1234
         option device ​ /​dev/​ttyUSB0         option device ​ /​dev/​ttyUSB0
Line 250: Line 422:
 ''​gcom''​ returns the signal quality in RSSI ([[wp>​Received signal strength indication]]) and in BER ([[wp>​Bit error rate]], reported in percent). A higher RSSI value represents a stronger signal - scale is from 0 to 99, where 1 is the lowest detectable signal and 31 a very good signal. Don't expect your signal to go all the way up to 99, though. If BER returns 99 it means not known or not detectable. ''​gcom''​ returns the signal quality in RSSI ([[wp>​Received signal strength indication]]) and in BER ([[wp>​Bit error rate]], reported in percent). A higher RSSI value represents a stronger signal - scale is from 0 to 99, where 1 is the lowest detectable signal and 31 a very good signal. Don't expect your signal to go all the way up to 99, though. If BER returns 99 it means not known or not detectable.
  
-| FIXME: Although I found the above information all across the net, I made different observations:​ My 3G modem is a ZTE K3565-Z ​which features ​a LED to show it's status (Not Connected, GPRS, UMTS). With reported RSSI value of around ​17 only get GPRS while a value of 4 allows for UMTS access. ​|+If your 3G modem is e.g. a ZTE K3565-Z ​featuring ​a LED SSI indicator ​to show it's status (Not Connected, GPRS, UMTS) you may be mislead to believe, that strong signal strength ​of e.g. 17 may be better, while you only get GPRS, but a value of 4 allows for UMTS access. ​This is owed to the circumstance,​ that the device may switch over to another cell. The only method to prevent a handover between a GPRS and an UMTS station during the process of optimizing, is to initiate the device to use 'UMTS only' in the first place.
  
 You can also add the AT command ​ You can also add the AT command ​
Line 284: Line 456:
  
 ===== Installing multiple 3G dongles ===== ===== Installing multiple 3G dongles =====
-You can use many usb 3G dongles with easy using active USB hub. 
  
-We assume ​You have at least one 3g dongle configured and active ​and You have working internet connection. If not - You'll need to install modules for 3g support before going to connect any 3g dongle. Check [[http://​wiki.openwrt.org/​doc/​recipes/​3gdongle]] for more information.+You can use many usb 3G dongles easily by using an active ​USB hub.
  
-1. Connect active USB hub to openWrt ​router. ​Check if hub power supply ​is big enough to power total count of 3g dongles. ​Roughly You'​ll ​need 500+ mAmp per one 3g dongle. Remember that modem can slightly exceed its declared power consumption in HDSPA+ modes. Be generous and pick USB hub with some power source overhead.+Prepare for the next steps: 
 +We assume you have at least one 3g dongle configured. You will need an active internet connection in order to install modules for 3g support. Check [[http://​wiki.openwrt.org/​doc/​recipes/​3gdongle]] for more information. 
 + 
 +1. Connect ​an active USB hub to the OpenWrt ​router. ​You need to assure, that the power supply ​will deliver sufficent ​power for all of your 3g dongles. ​A proper estimation is, that you will need 500+ mA per one 3g dongle. Remember that modem can slightly exceed its declared power consumption in HDSPA+ modes. Be generous and pick USB hub with some power source overhead.
  
 2. Connect all 3g dongles and start. 2. Connect all 3g dongles and start.
Line 294: Line 468:
 3. Browse through logread to check if modems are properly recognized and /ttyUSB ports are assigned. 3. Browse through logread to check if modems are properly recognized and /ttyUSB ports are assigned.
  
-4. Usually 3g modem have few ports - one for connection and others are service types. ​IE Huawei E1750 have 3 ports. ​First is communication port and last is service ​one. If You have only one modem it will be recognized as /ttyUSB0, /ttyUSB1 and /ttyUSB2. You need to configure interface using /ttyUSB0 (first one). Huawei E372 have 5 ports but similar to other Huawei communication port is the first one.+4. Usually ​3g modem has a few "​modem ​ports" ​- one for connection and others are service types. ​Exeplum gratum: A Huawei E1750 has three ports. ​The first in is communication port and last is service ​port. If you only have one modemit will be recognized as /ttyUSB0, /ttyUSB1 and /ttyUSB2. You need to configure interface using /ttyUSB0 (first one). Huawei E372 has five portsbut similar to other Huawei ​devices, the communication port is the first one.
  
-5. You need to configure interfaces. ​Ive configured first modem modifying existing Wan interface in "/​etc/​config/​network": ​+5. You need to configure interfaces. ​An example of "/​etc/​config/​network" ​could look like this
 <​code>​ <​code>​
 config '​interface'​ '​wan'​ config '​interface'​ '​wan'​
Line 307: Line 481:
  option '​password'​ ''​  option '​password'​ ''​
 </​code>​ </​code>​
-Usually ​You need to provide APN name in "​option '​apn'​ '​Name-Of-APN-HERE'"​. +Usually ​you need to provide ​an APN name in "​option '​apn'​ '​Name-Of-APN-HERE'"​. 
-If Your sim card have PIN or need to use username or pass - put it respectively there. +If your sim card is locked with a PINor if your porvider requires ​to use username ​and/or pass, add it accordingly.
-This should gives You working internet connection.+
  
 6. Check in log read next /ttyUSB[X] ports. In my case I have second modem starting with /ttyUSB3 (previous one use /ttyUSB0 to /ttyUSB2) so second interface looks like this: 6. Check in log read next /ttyUSB[X] ports. In my case I have second modem starting with /ttyUSB3 (previous one use /ttyUSB0 to /ttyUSB2) so second interface looks like this:
Line 323: Line 496:
  option '​password'​ ''​  option '​password'​ ''​
 </​code>​ </​code>​
-7. remember to add second interface to zone in firewall "/​etc/​config/​firewall": ​+7. remember to add second interface to the zone "​wan" ​in the firewall's config file "/​etc/​config/​firewall" ​(it may differ in your case)
 <​code>​ <​code>​
 config '​zone'​ config '​zone'​
Line 336: Line 509:
 Look at last line - there is wan2 added. Look at last line - there is wan2 added.
  
-8. Now You have both interfaces configured and they should work.+8. Now you have both interfaces configured and they should work.
  
 9. You can use both interfaces as  9. You can use both interfaces as 
Line 343: Line 516:
 ==== LOADBALANCER/​ MULTIWAN ==== ==== LOADBALANCER/​ MULTIWAN ====
  
 +| FIXME: This section needs a complete rewrite to fix spelling and grammar errors. |
 loadbalncer - [[https://​forum.openwrt.org/​viewtopic.php?​id=23904]] loadbalncer - [[https://​forum.openwrt.org/​viewtopic.php?​id=23904]]
  
Line 512: Line 686:
 </​code>​ </​code>​
  
-Multiwan - Additionally add 'option '​health_monitor'​ '​serial'​' ​at the beggining to help healthmonitor check for dropped ppp interface (Proposed by Jolouis).+Multiwan - Additionally add //option '​health_monitor'​ '​serial'​// at the beggining to help healthmonitor check for dropped ppp interface (Proposed by Jolouis).
  
 <​code>​ <​code>​
Line 552: Line 726:
  
  
-I have issues with auro reconnecting modems so Ive modified script for checking if modems are up. Script check modems separately.+I have issues with auto reconnecting modems so Ive modified script for checking if modems are up. Script check modems separately.
 Ive based this on great tutorial found at http://​eko.one.pl/?​p=openwrt-3g#​automatycznyrestartpoczenia Ive based this on great tutorial found at http://​eko.one.pl/?​p=openwrt-3g#​automatycznyrestartpoczenia
  
Line 583: Line 757:
 Restart of multiwan should take care of this situation. Restart of multiwan should take care of this situation.
  
- +===== Additional DNS configuration ===== 
-Additionally in case of DSN being not visible ​by local clients put 'list '​dhcp_option'​ '​6,​208.67.222.222,​208.67.220.220'​ More here: https://​forum.openwrt.org/​viewtopic.php?​id=17316+==== Advertising public DNS to clients ==== 
 +| **NOTE:** Advertising public DNS to clients is not recommended. Use [[#​Using.DNS.forwarding|DNS forwarding]] instead of this method. | 
 +| FIXME: This subsection needs rewrite to fix spelling and grammar errors | 
 +Additionally in case of DNS being not resolved ​by local clients put 'list '​dhcp_option'​ '​6,​208.67.222.222,​208.67.220.220'​ More here: https://​forum.openwrt.org/​viewtopic.php?​id=17316
 ' code into etc/​config/​dhcp ' code into etc/​config/​dhcp
 <​code>​ <​code>​
Line 617: Line 794:
 </​code>​ </​code>​
  
 +It could be made to work as described [[https://​forum.openwrt.org/​viewtopic.php?​pid=139499#​p139499|here]] in our Forum.
  
 +==== Using DNS forwarding ====
  
-It could be made to work as described ​[[https://forum.openwrt.org/​viewtopic.php?pid=139499#​p139499|here]in our Forum.+Please note that instead of advertising public dns servers((Some of public DNS servers are OpenDNS:​208.67.222.222,​208.67.220.220 and Google DNS:​8.8.8.8,​8.8.4.4)) for clients, it's better ​to just add server forwarding for dnsmasq, so that client dns requests are handled by dnsmasq and forwarded to appropriate dns servers. This example is using [[doc:techref:​uci|uci cli]] to configure dnsmasq to forward public dns requests to Google public dns servers((Google public dns doesn'​t hijack NXDOMAIN response, unlike OpenDNS)). 
 +<​code>​ 
 +uci add_list dhcp.@dnsmasq[-1].server=8.8.8.8 
 +uci add_list dhcp.@dnsmasq[-1].server=8.8.4.4 
 +uci commit dhcp 
 +</​code>​
  
 +If you prefer to edit /​etc/​config/​dhcp configuration manually:
 +
 +<​code>​
 +
 +config '​dnsmasq'​
 + option '​domainneeded'​ '​1'​
 + option '​boguspriv'​ '​1'​
 + option '​filterwin2k'​ '​0'​
 + option '​localise_queries'​ '​1'​
 + option '​rebind_protection'​ '​1'​
 + option '​rebind_localhost'​ '​1'​
 + option '​local'​ '/​lan/'​
 + option '​domain'​ '​lan'​
 + option '​expandhosts'​ '​1'​
 + option '​nonegcache'​ '​0'​
 + option '​authoritative'​ '​1'​
 + option '​readethers'​ '​1'​
 + option '​leasefile'​ '/​tmp/​dhcp.leases'​
 + option '​resolvfile'​ '/​tmp/​resolv.conf.auto'​
 + option '​server'​ '​8.8.8.8'​
 + option '​server'​ '​8.8.4.4'​
 +
 +config '​dhcp'​ '​lan'​
 + option '​interface'​ '​lan'​
 + option '​start'​ '​100'​
 + option '​limit'​ '​150'​
 + option '​leasetime'​ '​12h'​
 +
 +config '​dhcp'​ '​wan'​
 + option '​interface'​ '​wan'​
 + option '​ignore'​ '​1'​
 +
 +</​code>​
 +
 +If you prefer to ignore DNS servers obtained via PPP negotiation.
 +<code shell>
 +uci add dhcp.@dnsmasq[-1].noresolv=1
 +uci commit dhcp
 +</​code>​
 +
 +File /​etc/​config/​dhcp
 +<​code>​
 +config '​dnsmasq'​
 + option '​domainneeded'​ '​1'​
 + option '​boguspriv'​ '​1'​
 + option '​filterwin2k'​ '​0'​
 + option '​localise_queries'​ '​1'​
 + option '​rebind_protection'​ '​1'​
 + option '​rebind_localhost'​ '​1'​
 + option '​local'​ '/​lan/'​
 + option '​domain'​ '​lan'​
 + option '​expandhosts'​ '​1'​
 + option '​nonegcache'​ '​0'​
 + option '​authoritative'​ '​1'​
 + option '​readethers'​ '​1'​
 + option '​leasefile'​ '/​tmp/​dhcp.leases'​
 + option '​resolvfile'​ '/​tmp/​resolv.conf.auto'​
 + option '​server'​ '​8.8.8.8'​
 + option '​server'​ '​8.8.4.4'​
 + option '​noresolv'​ '​1'​
 +</​code>​
 +
 +This configuration is better, because clients will be able to resolve local hostnames, while utilizing dnsmasq to cache client dns requests.
 +
 +More dnsmasq tweaks are available [[doc:​uci:​dhcp#​all.options| here]] and [[doc:​howto:​dhcp.dnsmasq| here]].
 +
 +===== Easy Configuration Using Luci Web Interface =====
 +
 +[[doc:​howto:​luci.essentials|Luci]] has supported 3G configuration. Be sure to have **luci** and **luci-proto-3g** installed. If you want to do multiwan configuration,​ make sure that **luci-apps-multiwan** is installed and optionally, **luci-app-mwan3**.
 +
 +To create a new 3g connection, go to Luci web interface. Navigate to Network => interfaces. Click on **Add new interface** button. Give a simple name to the interface, for example **3g** and choose **UMTS/​GPRS/​EVDO** as its protocol.
 +
 +Here is basic configuration to get the connection working.
 +<​code>​
 +# General Setup
 +Protocol : UMTS/​GPRS/​EVDO
 +Modem device : /​dev/​ttyUSB0
 +Service type : UMTS only (You may prefer UMTS/GPRS if you wish)
 +APN : internet (Not needed for CDMA/EVDO)
 +PIN : 1234 (Leave it blank if you don't use pin)
 +PAP/CHAP username : <ask your 3G provider>​
 +PAP/CHAP password : <ask your 3G provider> ​
 +
 +# Advanced Settings (leave them as default)
 +
 +# Firewall Settings
 +Create / Assign firewall zone : wan
 +</​code>​
 +
 +===== Obtaining IPv6 address =====
 +If you want to enable IPv6 on 3G connection, make sure that your dongle supports PDPv6((To check if your dongle support PDPv6, open up serial terminal (Putty, screen, minicom, microcom, or picocom), and type **AT+CGDCONT=?​**. If the response shows a line containing "​IPV6",​ for example **+CGDCONT: (1-11),"​IPV6",,,​(0-2),​(0-3)**,​ your dongle supports PDPv6. Otherwise, your dongle is stuck with IPv4.)) and your 3G provider is providing IPv6 service.
 +
 +To enable IPv6 negotiation on the PPP link, issue the following command.
 +<​code>​
 +uci set network.3g.ipv6=1
 +uci commit network.3g
 +</​code>​
 +Be sure to replace //3g// with the correct name of 3G interface.
 +
 +In addition, be sure to edit file ''/​etc/​chatscripts/​3g.chat''​ for PDPv6 configuration as currently there is no [[doc:​techref:​uci|UCI]] entry for PDPv6.
 +<​code>​
 +ABORT   BUSY
 +ABORT   '​NO CARRIER'​
 +ABORT   ERROR
 +REPORT ​ CONNECT
 +TIMEOUT 10
 +"" ​     "​AT&​F"​
 +OK      "​ATE1"​
 +OK      '​AT+CGDCONT=1,"​IPV6","​$USE_APN"'​
 +SAY     "​Calling UMTS/​GPRS"​
 +TIMEOUT 30
 +OK      "​ATD$DIALNUMBER"​
 +CONNECT ' '
 +</​code>​
 +
 +You may use the following chatscript for PDPv4v6 configuration. Make sure that your dongle supports PDv4v6((See previous note.)) before attempting to modify the chatscript.
 +<​code>​
 +ABORT   BUSY
 +ABORT   '​NO CARRIER'​
 +ABORT   ERROR
 +REPORT ​ CONNECT
 +TIMEOUT 10
 +"" ​     "​AT&​F"​
 +OK      "​ATE1"​
 +OK      '​AT+CGDCONT=1,"​IPV4V6","​$USE_APN"'​
 +SAY     "​Calling UMTS/​GPRS"​
 +TIMEOUT 30
 +OK      "​ATD$DIALNUMBER"​
 +CONNECT ' '
 +</​code>​
 +
 +If you are using Luci, be sure to check //Enable IPv6 negotiation on the PPP link// and optionally //Use builtin IPv6-management//​ on the //Advanced settings// section of the 3G interface configuration page. Also, be sure to modify /​etc/​chatscripts/​3g.chat file for PDPv6 as explained above.
 +
 +Of course you can use other methods to obtain IPv6 instead of relying on PPP negotiation. [[doc:​uci:​network6|Go to this page]] for more explanation.
  
 ===== Compile things yourself ===== ===== Compile things yourself =====
Line 626: Line 944:
  
 {{tag>​USBrelated}} {{tag>​USBrelated}}
 +
 +===== Workarounds =====
 +==== TP-Link MA260/​Attitude Adjustment ====
 +This workaround is valid for Attitude Adjustment, but has been obsoleted by [[https://​dev.openwrt.org/​changeset/​36812|r36812]] and newer builds, such as Barrier Breaker 14.07.
 +
 +If you plug the MA260 into the USB port of a compatible OpenWRT device running Attitude Adjustment, you will notice certain issues, similar to those described in the Ubuntu forum: [TP Link MA260, Ubuntu 12.04 LTS[http://​ubuntuforums.org/​showthread.php?​t=2197164]],​ e.g. missing modeswitch routines missing hotplug etc.
 +
 +Create and edit the file /​etc/​hotplug.d/​usb/​21-tplink_ma260 with the following content:
 +
 +<​code>​
 +#​!/​bin/​sh ​                                                                                                                                      
 +BINARY="/​usr/​bin/​usb_modeswitch" ​                                                                                                               ​
 +                                                                                                                                                ​
 +TPLINKMA260_PRODID1="​2357/​f000/​0" ​                                                                                                              
 +TPLINKMA260_PRODID2="​2357/​9000/​0" ​                                                                                                              
 +                                                                                                                                                ​
 +# switch from storage mode to modem mode                                                                                                        ​
 +if [ "​${PRODUCT}"​ = "​${TPLINKMA260_PRODID1}"​ ]; then                                                                                            ​
 +        if [ "​${ACTION}"​ = "​add"​ ]; then                                                                                                        ​
 +                # give the storage some time to finish mounting ​                                                                                
 +                sleep 15                                                                                                                        ​
 +                # issue the modeswitch and change the product id.                                                                               
 +                ${BINARY} -v 2357 -p f000 -V 2357 -P 9000 -W -I -n \                                                                            ​
 +                -M '​5553424312345678000000000000061e000000000000000000000000000000'​ \                                                           
 +                -2 '​5553424312345678000000000000061b000000020000000000000000000000' ​                                                            
 +                logger -t HOTPLUG "​${TPLINKMA260_PRODID1} plugged in." ​                                                                         ​
 +        fi                                                                                                                                      ​
 +        if [ "​${ACTION}"​ = "​remove"​ ]; then                                                                                                     
 +                logger -t HOTPLUG "​${TPLINKMA260_PRODID1} was removed." ​                                                                        
 +        fi                                                                                                                                      ​
 +fi                                                                                                                                              ​
 +                                                                                                                                                ​
 +if [ "​${PRODUCT}"​ = "​${TPLINKMA260_PRODID2}"​ ]; then                                                                                            ​
 +        if [ "​${ACTION}"​ = "​add"​ ]; then                                                                                                        ​
 +                #register usbserial and option device driver with the modem mode id:                                                            ​
 +                echo '2357 9000 ff' > /​sys/​bus/​usb-serial/​drivers/​option1/​new_id ​                                                               ​
 +                logger -t HOTPLUG "​${TPLINKMA260_PRODID2} plugged in." ​                                                                         ​
 +        fi                                                                                                                                      ​
 +        if [ "​${ACTION}"​ = "​remove"​ ]; then                                                                                                     
 +                logger -t HOTPLUG "​${TPLINKMA260_PRODID2} was removed." ​                                                                        
 +        fi                                                                                                                                      ​
 +fi
 +</​code>​
 +Similar workaround may apply to TP-Link MA180.
 +
 +In order to work correctly the package usb_modeswitch needs to be installed.
 +
 +==== TP-Link MA260/​Barrier Breaker ====
 +FIXME: The device should work out of the box.
 +If you update from Attitude Adjustment, you should remove old config files, since they are no longer used since [[https://​dev.openwrt.org/​changeset/​36812|r36812]].
 +
 +The //usbmode// binary has been replaced by the //​usb_modeswitch//​ binary to do modeswitching tasks.
 +A JSON-style 3g-dongle database now prepares all necessary information for initialization.
 +You will find more information on how this works in [[http://​wiki.openwrt.org/​doc/​recipes/​3gdongle|3G-Dongle recipes]].
 +
 +FIXME:
 +If you still encounter problems, you may need to figure out how to submit the following messages to your dongle:
 +allow eject: 5553424312345678000000000000061e000000000000000000000000000000
 +eject: 5553424312345678000000000000061b000000020000000000000000000000
 +
 +===== Devices using qmi and mbim protocol =====
 +
 +Some new 3G/4G dongles use **qmi** and **mbim** protocol to establish connection to ISP.
 +For your information,​ [[https://​blogs.gnome.org/​dcbw/​2010/​04/​15/​mobile-broadband-and-qualcomm-proprietary-protocols/​|qmi protocol]] is proprietary protocol by Qualcomm. In contrast to qmi, [[http://​compliance.usb.org/​mbim/​|mbim]] is more standardized protocol for 3G/4G dongles.
 +
 +=== QMI Protocol Configuration ===
 +
 +To make use of qmi protocol, package **kmod-usb-net-qmi-wwan** and **uqmi** are needed. **uqmi** is available on both **barrier breaker** and **bleeding edge** repository.
 +
 +Here is a brief help about **uqmi** command line usage.
 +
 +<code sh>
 +No device given
 +Usage: uqmi <​options|actions>​
 +Options:
 +  --single, -s:                     Print output as a single line (for scripts)
 +  --device=NAME,​ -d NAME:           Set device name to NAME (required)
 +  --keep-client-id <​name>: ​         Keep Client ID for service <​name>​
 +  --release-client-id <​name>: ​      ​Release Client ID after exiting
 +
 +Services: ​                          dms, nas, pds, wds, wms
 +
 +Actions:
 +  --get-versions: ​                  Get service versions
 +  --set-client-id <​name>,<​id>: ​     Set Client ID for service <​name>​ to <id>
 +                                    (implies --keep-client-id)
 +  --get-client-id <​name>: ​          ​Connect and get Client ID for service <​name>​
 +                                    (implies --keep-client-id)
 +  --start-network <​apn>: ​           Start network connection (use with options below)
 +    --auth-type pap|chap|both|none:​ Use network authentication type
 +    --username <​name>: ​             Use network username
 +    --password <​password>: ​         Use network password
 +    --autoconnect: ​                 Enable automatic connect/​reconnect
 +  --stop-network <​pdh>: ​            Stop network connection (use with option below)
 +    --autoconnect: ​                 Disable automatic connect/​reconnect
 +  --get-data-status: ​               Get current data access status
 +  --set-autoconnect <​val>: ​         Get current data access status (disabled, enabled, paused)
 +  --get-pin-status: ​                Get PIN verification status
 +  --verify-pin1 <​pin>: ​             Verify PIN1
 +  --verify-pin2 <​pin>: ​             Verify PIN2
 +  --get-imsi: ​                      Get International Mobile Subscriber ID
 +  --reset-dms: ​                     Reset the DMS service
 +  --set-device-operating-mode <​m> ​  Set the device operating mode
 +                                    (modes: online, low_power, factory_test,​ offline
 +                                     ​reset,​ shutting_down,​ persistent_low_power,​
 +                                     ​mode_only_low_power)
 +  --set-network-modes <​modes>: ​     Set usable network modes (Syntax: <​mode1>​[,<​mode2>,​...])
 +                                    Available modes: all, lte, umts, gsm, cdma, td-scdma
 +  --set-network-preference <​mode>: ​ Set preferred network mode to <​mode>​
 +                                    Available modes: auto, gsm, wcdma
 +  --set-network-roaming <​mode>: ​    Set roaming preference:
 +                                    Available modes: any, off, only
 +  --network-scan: ​                  ​Initiate network scan
 +  --network-register: ​              ​Initiate network register
 +  --get-signal-info: ​               Get signal strength info
 +  --get-serving-system: ​            Get serving system info
 +  --list-messages: ​                 List SMS messages
 +  --get-message <​id>: ​              Get SMS message at index <id>
 +  --get-raw-message <​id>: ​          Get SMS raw message contents at index <id>
 +  --send-message <​data>: ​           Send SMS message (use options below)
 +    --send-message-smsc <​nr>: ​      SMSC number (required)
 +    --send-message-target <​nr>: ​    ​Destination number (required)
 +    --send-message-flash: ​          Send as Flash SMS
 +
 +</​code>​
 +
 +[[doc:​uci|UCI]] has supported **qmi** network protocol configuration. The detailed explanation about qmi network configuration is explained [[doc:​uci:​network#​protocol.qmi.usb.modems.using.qmi.protocol|here]].
 +
 +Currently, there is no such thing as **<​del>​luci-proto-qmi</​del>​** yet to make use of [[doc:​techref:​luci | Luci]] for qmi configuration. You need to configure UCI manually using [[doc:​techref:​uci|uci command line]] or [[doc:​howto:​user.beginner.cli#​editing.files| text editor]].
 +
 +=== MBIM Protocol configuration ===
 +
 +Currently, there is not enough information about mbim protocol as it's being actively developed. If you are curious about setting up mbim protocol, you may ask [[https://​lists.openwrt.org/​cgi-bin/​mailman/​listinfo | OpenWrt users/devel mailing lists]] or [[https://​forum.openwrt.org | OpenWrt forum]]
 +
 +Here is a brief help about **umbim** command line.
 +<code sh>
 +umbim help
 +Usage: mbim <​caps|pinstate|unlock|connect|disconnect>​ [options]
 +Options:
 +    -d <​device>​ the device (/​dev/​cdc-wdmX)
 +    -t <​transaction> ​   the transaction id
 +    -n          no close
 +
 +    -v          verbose
 +</​code> ​ - Ordered List Item
 +
doc/recipes/3gdongle.1355003343.txt.bz2 · Last modified: 2012/12/08 22:49 by ajo