How to connect 3G modem to Vera

From MiOS
(Difference between revisions)
Jump to: navigation, search
(Instructions)
 
Line 1: Line 1:
 +
[[Category:How_To]]
 
This guide applies to Vera units with firmware version starting with 1.5.622 and works only when the WAN&nbsp;port is not connected, and the modem is manually set to connect. <span>When the wire is plugged back, the WAN becomes the default gateway.</span>  
 
This guide applies to Vera units with firmware version starting with 1.5.622 and works only when the WAN&nbsp;port is not connected, and the modem is manually set to connect. <span>When the wire is plugged back, the WAN becomes the default gateway.</span>  
  

Latest revision as of 02:33, 15 June 2013

This guide applies to Vera units with firmware version starting with 1.5.622 and works only when the WAN port is not connected, and the modem is manually set to connect. When the wire is plugged back, the WAN becomes the default gateway.


Supported 3G Modems :

Huawei E153
ZTE MF180
ZTE MF667F 

[edit] Instructions

Connect to the unit by ssh as explained here, then follow these steps:

1. Disable network-autoconfigure

rm /etc/cmh/fresh_install

1.2. Add 3G support in /usr/bin/GetNetworkState.sh script

wan)
                [[ "$(uci -P/var/state/ get network.3g.up 2>/dev/null)" == "1" ]] && { echo "UP"; exit; }
                
ip_wan)
                [[ "$(uci -P/var/state get network.wan.up 2>/dev/null)" != "0" ]] && [[ "$(uci -P/var/state get network.3g.up 2>/dev/null)" == "1" ]] && {
                                uci -P/var/state get network.3g.ipaddr 2>/dev/null
                                exit
                }

1.3 Add 3G support in /usr/bin/Report_AP.sh

#TODO - report if unit is in WifiClientMode                                                                                       
    WanIP="$(GetNetworkState.sh ip_wan)"                                                                                                  
    if [[ "$WanIP" == "" ]]; then 

2. Plug in USB Modem in Vera

3. Check if the modem is insterted correctly and that vera can see it .

gcom info /dev/ttyUSBx | x = 0 or 1 

4. In /etc/config/network add the following :

config 'interface' '3g'
        option 'ifname' 'ppp0'
        option 'device' '/dev/ttyUSB0'
        option 'apn' 'internet'
        option 'service' 'umts'
        option 'proto' '3g'
              

If the modem has a PIN code add it :

  option 'pincode' '1234' 

If the modem requires an username and password set it :

  option username yourusername
  option password yourpassword

Save and exit


5. Check 3G chatscripts ( they are used for the method of connection )

cat /etc/chatscripts/3g.chat

    ABORT   BUSY
    ABORT   'NO CARRIER'
    ABORT   ERROR
    REPORT  CONNECT
    TIMEOUT 10
    ""      "AT+CSQ"
    OK      "ATE1"
    OK      'AT+CGDCONT=1,"IP","$USE_APN"'
    SAY     "Calling UMTS/GPRS"
    TIMEOUT 30
    OK      "ATD*99***1#"
    CONNECT ' '


Settings should be like the ones above.


5. Restart network (be sure to on lan conected to it , not by wan !! IT will not show debugging info )

/etc/init.d/network restart

    BRIDGE ADDBR : brctl addbr br-lan
    BRIDGE ADDIF br-lan eth0.1
    BRIDGE ADDIF : brctl addif br-lan wlan0
    BRIDGE DELIF : brctl delif br-lan
    Configuration file: /var/run/hostapd-phy0.conf
    Using interface wlan0 with hwaddr 00:0e:XX:XX:XX:XX and ssid 'mios_wifi'
    BRIDGE DELIF : brctl delif br-lan wlan0
    BRIDGE ADDIF : brctl addif br-lan wlan0

6. Watch logread with the following parameters :

logread -f | grep local2.info 

It should be like this

    Feb 15 04:18:15 MiOS_3xxxxxxx local2.info chat[11495]: abort on (BUSY)
    Feb 15 04:18:15 MiOS_3xxxxxxx local2.info chat[11495]: abort on (NO CARRIER)
    Feb 15 04:18:15 MiOS_3xxxxxxx local2.info chat[11495]: abort on (ERROR)
    Feb 15 04:18:15 MiOS_3xxxxxxx local2.info chat[11495]: report (CONNECT)
    Feb 15 04:18:15 MiOS_3xxxxxxx local2.info chat[11495]: timeout set to 10 seconds
    Feb 15 04:18:15 MiOS_3xxxxxxx local2.info chat[11495]: send (AT+CSQ^M)
    Feb 15 04:18:15 MiOS_3xxxxxxx local2.info chat[11495]: expect (OK)
    Feb 15 04:18:15 MiOS_3xxxxxxx local2.info chat[11495]: AT+CSQ^M^M
    Feb 15 04:18:15 MiOS_3xxxxxxx local2.info chat[11495]: +CSQ: 24,99^M
    Feb 15 04:18:15 MiOS_3xxxxxxx local2.info chat[11495]: ^M
    Feb 15 04:18:15 MiOS_3xxxxxxx local2.info chat[11495]: OK
    Feb 15 04:18:15 MiOS_3xxxxxxx local2.info chat[11495]:  -- got it
    Feb 15 04:18:15 MiOS_3xxxxxxx local2.info chat[11495]: send (ATE1^M)
    Feb 15 04:18:15 MiOS_3xxxxxxx local2.info chat[11495]: expect (OK)
    Feb 15 04:18:15 MiOS_3xxxxxxx local2.info chat[11495]: ^M
    Feb 15 04:18:15 MiOS_3xxxxxxx local2.info chat[11495]: ATE1^M^M
    Feb 15 04:18:15 MiOS_3xxxxxxx local2.info chat[11495]: OK


7. Check ifconfig


         3g-wan    Link encap:Point-to-Point Protocol
inet addr:172.XXX.XXX.XXX  P-t-P:10.XXX.XXX.XXX  Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
RX packets:2671 errors:0 dropped:0 overruns:0 frame:0
TX packets:2449 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:1025131 (1001.1 KiB)  TX bytes:717822 (700.9 KiB)


8. Stop and start 3G

To stop it :

ifdown wan 

To start it  :

ifup wan 

  If you encounter any issues you can check the logs at :

logread -f | grep local2.info 

[edit]
 Possible issues :

1. Not being able to connect to the modem (on /etc/init.d/network restart -> no such device)

Cause :

USB port miss-configuration

Resolution :

Type the code below until the USB modem is detected

gcom info /dev/ttyUSBx 

Then update the option 'device' '/dev/ttyUSB0' in

/etc/config/network 

2. 3G (error) PIN code incorrect :

Be sure to set the PIN if it has one, or if it doesn't have one dont set it at all.

3. Remote access doesn't work anymore :

Certain providers block the remote access port, so the unit can't connect anymore to the remote access server.

A possible solution would be to check "FailSafe Tunnels" from Setup > Net&Wifi page on the user interface.






Personal tools