OpenWrt Forum Archive

Topic: How to know the mobile network

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

Hello,

I've installed OpenWrt on a TP-Link and i want to use the 2G and the EDGE network. The 3G network is working, but how can i know which network i'm on it ?

My configuration :

/etc/config/network :

config interface 'wan'
        option device '/dev/ttyUSB0'
        option service 'umts/gprs'
        option proto '3g'
        option pppd_options 'noipdefault'
        option pincode 'xxxx'
        option apn 'websfr'

/etc/chatscript/3g.chat ( comgt ) :

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

ifconfig -I 3g-wan :

3g-wan    Link encap:Point-to-Point Protocol
          inet addr:100.78.74.102  P-t-P:10.64.64.64  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:54 errors:0 dropped:0 overruns:0 frame:0
          TX packets:84 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:3728 (3.6 KiB)  TX bytes:5468 (5.3 KiB)

logread :

Tue May 23 12:27:37 2017 daemon.notice netifd: wan (2243): SIM ready
Tue May 23 12:27:37 2017 daemon.notice netifd: wan (2243): PIN set successfully
Tue May 23 12:27:37 2017 daemon.notice pppd[2275]: pppd 2.4.7 started by root, uid 0
Tue May 23 12:27:38 2017 local2.info chat[2281]: abort on (BUSY)
Tue May 23 12:27:38 2017 local2.info chat[2281]: abort on (NO CARRIER)
Tue May 23 12:27:38 2017 local2.info chat[2281]: abort on (ERROR)
Tue May 23 12:27:38 2017 local2.info chat[2281]: report (CONNECT)
Tue May 23 12:27:38 2017 local2.info chat[2281]: timeout set to 10 seconds
Tue May 23 12:27:38 2017 local2.info chat[2281]: send (AT&F^M)
Tue May 23 12:27:38 2017 local2.info chat[2281]: expect (OK)
Tue May 23 12:27:38 2017 local2.info chat[2281]: AT&F^M^M
Tue May 23 12:27:38 2017 local2.info chat[2281]: OK
Tue May 23 12:27:38 2017 local2.info chat[2281]:  -- got it
Tue May 23 12:27:38 2017 local2.info chat[2281]: send (ATE1^M)
Tue May 23 12:27:39 2017 local2.info chat[2281]: expect (OK)
Tue May 23 12:27:39 2017 local2.info chat[2281]: ^M
Tue May 23 12:27:39 2017 local2.info chat[2281]: ^M
Tue May 23 12:27:39 2017 local2.info chat[2281]: OK
Tue May 23 12:27:39 2017 local2.info chat[2281]:  -- got it
Tue May 23 12:27:39 2017 local2.info chat[2281]: send (AT+CGDCONT=1,"IP","wapsfr"^M)
Tue May 23 12:27:39 2017 local2.info chat[2281]: timeout set to 30 seconds
Tue May 23 12:27:39 2017 local2.info chat[2281]: expect (OK)
Tue May 23 12:27:39 2017 local2.info chat[2281]: ^M
Tue May 23 12:27:39 2017 local2.info chat[2281]: AT+CGDCONT=1,"IP","wapsfr"^M^M
Tue May 23 12:27:39 2017 local2.info chat[2281]: OK
Tue May 23 12:27:39 2017 local2.info chat[2281]:  -- got it
Tue May 23 12:27:39 2017 local2.info chat[2281]: send (ATD*99***1#^M)
Tue May 23 12:27:39 2017 local2.info chat[2281]: expect (CONNECT)
Tue May 23 12:27:39 2017 local2.info chat[2281]: ^M
Tue May 23 12:27:39 2017 local2.info chat[2281]: ATD*99***1#^M^M
Tue May 23 12:27:39 2017 local2.info chat[2281]: CONNECT
Tue May 23 12:27:39 2017 local2.info chat[2281]:  -- got it
Tue May 23 12:27:39 2017 local2.info chat[2281]: send ( ^M)
Tue May 23 12:27:39 2017 daemon.info pppd[2275]: Serial connection established.
Tue May 23 12:27:39 2017 kern.info kernel: [   96.340000] 3g-wan: renamed from ppp0
Tue May 23 12:27:39 2017 daemon.info pppd[2275]: Using interface 3g-wan
Tue May 23 12:27:39 2017 daemon.notice pppd[2275]: Connect: 3g-wan <--> /dev/ttyUSB0
Tue May 23 12:27:43 2017 daemon.warn pppd[2275]: Could not determine remote IP address: defaulting to 10.64.64.64
Tue May 23 12:27:43 2017 daemon.notice pppd[2275]: local  IP address 100.78.74.102
Tue May 23 12:27:43 2017 daemon.notice pppd[2275]: remote IP address 10.64.64.64
Tue May 23 12:27:43 2017 daemon.notice pppd[2275]: primary   DNS address 172.20.2.39
Tue May 23 12:27:43 2017 daemon.notice pppd[2275]: secondary DNS address 172.20.2.10
Tue May 23 12:27:43 2017 daemon.notice netifd: Network device '3g-wan' link is up


TP-Link MR3020
3G Modem :
- HSUPA 7,2Mbps
- HSDPA 7,2Mbps

Thanks for your help, Simon.

(Last edited by SimonR on 23 May 2017, 13:39)

Hello, nobody had the solution, because i'm stuck in the city i can use the 3G, but In the countryside and i can't be connected on the 2g or the Edge.

Thanks

I think the 'AT+CREG?' command can give you the network registration status and the access technology of the cell. Whether the operator of the cell supports downgrading of the access technology depending on signal strength is a wholly another matter, though.

Also, the '3g' protocol should support PPP connections over both UMTS (3g) and GPRS/EDGE (2g / 2.5g).

Thanks for your answer, so i don't understand why my 3g modem take only the 3G network..

Without knowing the make and model of your 3G modem, it's difficult to help further. Perhaps it doesn't have support for GPRS or EDGE connectivity? (http://www.umtsworld.com/umts/faq.htm#f26)

Or perhaps the cell operator doesn't have a 2g or 2.5g base station?

The chat and ppp drivers just see a connection that packets go through.  They aren't concerned with whether it is 2G or 3G. 

It is up to the modem to negotiate the fastest physical radio link to the network that is compatible at both ends.  There are sometimes some AT commands that enable or disable different modes.  These should only need to be used once then the modem stores the configuration internally.

Can you connect to that tower with the modem plugged into a laptop?

Well the Qualcomm MSM7227 chip has support for GPRS, EDGE and UMTS at least. So, maybe there's an AT command that allows you to disable one networking mode or the other. I kind of doubt it, however, since this SoC is intended to be used in mobile phones and mobile phones are notorious for their ability to automatically adjust the network depending on the circumstances.

Long story short: have you actually tried the connection somewhere where only a 2G network is available? Do you get an error code or something, which might help us further? Or does it simply say "out of order"? smile

Hello Antek and mk24, thanks for your answers,

I will try to make my own script with AT command.

So there is the different test :
- In the countryside with a laptop and the differents 3G modem : WORKING ( EDGE or 3G )
- In the countryside with a TP-Link and the differents 3G modem : NOT WORKING ( Nothing )
- In the city with a TP-Link and the differents 3G modem : WORKING ( 3G )
- In the city with a laptop and the differents 3G modem : WORKING ( 3G )

When is not working, i got that :

Wed May 31 15:01:29 2017 daemon.notice netifd: Interface 'wan' is now down
Wed May 31 15:01:29 2017 daemon.notice netifd: Interface 'wan' is setting up now
Wed May 31 15:01:33 2017 daemon.notice netifd: wan (16630): SIM ready
Wed May 31 15:01:33 2017 daemon.notice netifd: wan (16630): PIN set successfully
Wed May 31 15:01:33 2017 daemon.notice pppd[17010]: pppd 2.4.7 started by root, uid 0
Wed May 31 15:01:34 2017 local2.info chat[17123]: abort on (BUSY)
Wed May 31 15:01:34 2017 local2.info chat[17123]: abort on (NO CARRIER)
Wed May 31 15:01:34 2017 local2.info chat[17123]: abort on (ERROR)
Wed May 31 15:01:34 2017 local2.info chat[17123]: report (CONNECT)
Wed May 31 15:01:34 2017 local2.info chat[17123]: timeout set to 10 seconds
Wed May 31 15:01:34 2017 local2.info chat[17123]: send (AT&F^M)
Wed May 31 15:01:34 2017 local2.info chat[17123]: expect (OK)
Wed May 31 15:01:34 2017 local2.info chat[17123]: AT&F^M^M
Wed May 31 15:01:34 2017 local2.info chat[17123]: OK
Wed May 31 15:01:34 2017 local2.info chat[17123]:  -- got it
Wed May 31 15:01:34 2017 local2.info chat[17123]: send (ATE1^M)
Wed May 31 15:01:34 2017 local2.info chat[17123]: expect (OK)
Wed May 31 15:01:34 2017 local2.info chat[17123]: ^M
Wed May 31 15:01:34 2017 local2.info chat[17123]: ^M
Wed May 31 15:01:34 2017 local2.info chat[17123]: OK
Wed May 31 15:01:34 2017 local2.info chat[17123]:  -- got it
Wed May 31 15:01:34 2017 local2.info chat[17123]: send (AT+CGDCONT=1,"IP","websfr"^M)
Wed May 31 15:01:34 2017 local2.info chat[17123]: timeout set to 30 seconds
Wed May 31 15:01:34 2017 local2.info chat[17123]: expect (OK)
Wed May 31 15:01:34 2017 local2.info chat[17123]: ^M
Wed May 31 15:01:34 2017 local2.info chat[17123]: AT+CGDCONT=1,"IP","websfr"^M^M
Wed May 31 15:01:34 2017 local2.info chat[17123]: OK
Wed May 31 15:01:34 2017 local2.info chat[17123]:  -- got it
Wed May 31 15:01:34 2017 local2.info chat[17123]: send (ATD*99***1#^M)
Wed May 31 15:01:34 2017 local2.info chat[17123]: expect (CONNECT)
Wed May 31 15:01:34 2017 local2.info chat[17123]: ^M
Wed May 31 15:01:34 2017 local2.info chat[17123]: ATD*99***1#^M^M
Wed May 31 15:01:34 2017 local2.info chat[17123]: CONNECT
Wed May 31 15:01:34 2017 local2.info chat[17123]:  -- got it
Wed May 31 15:01:34 2017 local2.info chat[17123]: send ( ^M)
Wed May 31 15:01:34 2017 daemon.info pppd[17010]: Serial connection established.
Wed May 31 15:01:34 2017 daemon.info pppd[17010]: Using interface 3g-wan
Wed May 31 15:01:34 2017 daemon.notice pppd[17010]: Connect: 3g-wan <--> /dev/ttyUSB0
Wed May 31 15:01:34 2017 kern.info kernel: [ 3532.390000] 3g-wan: renamed from ppp0
Wed May 31 15:01:37 2017 daemon.notice pppd[17010]: Modem hangup
Wed May 31 15:01:37 2017 daemon.notice pppd[17010]: Connection terminated.
Wed May 31 15:01:38 2017 daemon.info pppd[17010]: Exit.
Wed May 31 15:01:38 2017 daemon.notice netifd: Interface 'wan' is now down
Wed May 31 15:01:38 2017 daemon.notice netifd: Interface 'wan' is setting up now

here is not working because i use the wrong APN, but when i am in the countryside i know that is not working because i can't go in internet, and my "wan" interface dont get an IP address. For the moment i'am not in the country side but i will give you the right log later.

Thanks

The discussion might have continued from here.