Monday, August 10, 2015

connect Internet with 3G Modem on openwrt with comgt

1- install necessary packages
# opkg update
# opkg install kmod-usb-serial kmod-usb2 kmod-usb-uhci kmod-usb-ohci

2-  update network configuration to include 3g interface called 3gwan in the file /etc/config/network

config interface '3gwan'
        option proto    3g
        option 'service' 'umts'
        option dialnumber '*99#'
        option device   /dev/ttyUSB3
        option apn      'your.apn.name'
        option username 'your.username'
        option password 'your.password'

3- update 3g chatscripts in /etc/chatscripts/3g.chat

ABORT   BUSY
ABORT   'NO CARRIER'
ABORT   ERROR
REPORT  CONNECT
TIMEOUT 12
""      "AT&F"
OK      "ATE1"
OK      'AT+CGDCONT=1,"IP","$USE_APN"'
ABORT   'NO CARRIER'
TIMEOUT 15
OK      "ATD*99#"
CONNECT ' '

4- connect/disconnect using comment ifup and ifdown
# ifup 3gwan  (to start connect with 3G
# ifdown 3gwan (stop the connection)

5- read log using command logread

# readlog
Mon Aug 10 09:35:29 2015 daemon.notice netifd: Interface '3gwan' is setting up now
Mon Aug 10 09:35:30 2015 daemon.notice pppd[7480]: pppd 2.4.7 started by root, uid 0
Mon Aug 10 09:35:31 2015 local2.info chat[7483]: abort on (BUSY)
Mon Aug 10 09:35:31 2015 local2.info chat[7483]: abort on (NO CARRIER)
Mon Aug 10 09:35:31 2015 local2.info chat[7483]: abort on (ERROR)
Mon Aug 10 09:35:31 2015 local2.info chat[7483]: report (CONNECT)
Mon Aug 10 09:35:31 2015 local2.info chat[7483]: timeout set to 12 seconds
Mon Aug 10 09:35:31 2015 local2.info chat[7483]: send (AT&F^M)
Mon Aug 10 09:35:31 2015 local2.info chat[7483]: expect (OK)
Mon Aug 10 09:35:31 2015 local2.info chat[7483]: AT&F^M^M
Mon Aug 10 09:35:31 2015 local2.info chat[7483]: OK
Mon Aug 10 09:35:31 2015 local2.info chat[7483]:  -- got it
Mon Aug 10 09:35:31 2015 local2.info chat[7483]: send (ATE1^M)
Mon Aug 10 09:35:31 2015 local2.info chat[7483]: expect (OK)
Mon Aug 10 09:35:31 2015 local2.info chat[7483]: ^M
Mon Aug 10 09:35:31 2015 local2.info chat[7483]: ATE1^M^M
Mon Aug 10 09:35:31 2015 local2.info chat[7483]: OK
Mon Aug 10 09:35:31 2015 local2.info chat[7483]:  -- got it
Mon Aug 10 09:35:31 2015 local2.info chat[7483]: send (AT+CGDCONT=1,"IP","metfone"^M)
Mon Aug 10 09:35:32 2015 local2.info chat[7483]: abort on (NO CARRIER)
Mon Aug 10 09:35:32 2015 local2.info chat[7483]: timeout set to 15 seconds
Mon Aug 10 09:35:32 2015 local2.info chat[7483]: expect (OK)
Mon Aug 10 09:35:32 2015 local2.info chat[7483]: ^M
Mon Aug 10 09:35:32 2015 local2.info chat[7483]: AT+CGDCONT=1,"IP","metfone"^M^M
Mon Aug 10 09:35:32 2015 local2.info chat[7483]: OK
Mon Aug 10 09:35:32 2015 local2.info chat[7483]:  -- got it
Mon Aug 10 09:35:32 2015 local2.info chat[7483]: send (ATD*99#^M)
Mon Aug 10 09:35:32 2015 local2.info chat[7483]: expect (CONNECT)
Mon Aug 10 09:35:32 2015 local2.info chat[7483]: ^M
Mon Aug 10 09:35:32 2015 local2.info chat[7483]: ATD*99#^M^M
Mon Aug 10 09:35:32 2015 local2.info chat[7483]: CONNECT
Mon Aug 10 09:35:32 2015 local2.info chat[7483]:  -- got it
Mon Aug 10 09:35:32 2015 local2.info chat[7483]: send ( ^M)
Mon Aug 10 09:35:32 2015 daemon.info pppd[7480]: Serial connection established.
Mon Aug 10 09:35:32 2015 kern.info kernel: [ 2533.180000] 3g-3gwan: renamed from ppp0
Mon Aug 10 09:35:32 2015 daemon.info pppd[7480]: Using interface 3g-3gwan
Mon Aug 10 09:35:32 2015 daemon.notice pppd[7480]: Connect: 3g-3gwan <--> /dev/ttyUSB3
Mon Aug 10 09:35:33 2015 daemon.info pppd[7480]: CHAP authentication succeeded
Mon Aug 10 09:35:33 2015 daemon.notice pppd[7480]: CHAP authentication succeeded
Mon Aug 10 09:35:35 2015 daemon.warn pppd[7480]: Could not determine remote IP address: defaulting to 10.64.64.64
Mon Aug 10 09:35:35 2015 daemon.notice pppd[7480]: local  IP address 10.27.81.176
Mon Aug 10 09:35:35 2015 daemon.notice pppd[7480]: remote IP address 10.64.64.64
Mon Aug 10 09:35:35 2015 daemon.notice pppd[7480]: primary   DNS address 117.120.24.1
Mon Aug 10 09:35:35 2015 daemon.notice pppd[7480]: secondary DNS address 117.120.24.2
Mon Aug 10 09:35:35 2015 daemon.notice netifd: Network device '3g-3gwan' link is up
Mon Aug 10 09:35:35 2015 daemon.notice netifd: Interface '3gwan' is now up
Mon Aug 10 09:35:35 2015 daemon.info dnsmasq[1392]: reading /tmp/resolv.conf.auto
Mon Aug 10 09:35:35 2015 daemon.info dnsmasq[1392]: using local addresses only for domain lan
Mon Aug 10 09:35:35 2015 daemon.info dnsmasq[1392]: using nameserver 117.120.24.1#53
Mon Aug 10 09:35:35 2015 daemon.info dnsmasq[1392]: using nameserver 117.120.24.2#53
Mon Aug 10 09:35:35 2015 daemon.info dnsmasq[1392]: using nameserver 8.8.8.8#53
Mon Aug 10 09:36:03 2015 daemon.warn pppd[7480]: IPV6CP: timeout sending Config-Requests


6- diagnostic the modem status
# gcom -d /dev/ttyUSB3
 SIM ready
Waiting for Registration..(120 sec max)
Registered on Home network: "Metfone",2
Signal Quality: 14,99

if we use above command and it return signal quality like above, it will work

# comgt sig -d /dev/ttyUSB3  (to get signal status)
# comgt info -d /dev/ttyUSB3  (to get modem info)


We can see it connected in the web admin.
openwrt 3g modem comgt gcom

No comments:

Post a Comment