Page tree
Skip to end of metadata
Go to start of metadata

PPP拨号方式

修改/etc/network/interfaces文件,启用gprs-dial拨号脚本后,即可拨号自动连接。

root@i2c6ulxbn:~# cat /etc/network/interfaces
auto lo
iface lo inet loopback
iface ppp0 inet ppp
        provider gprs-dial
#       provider 3g-dial
#       provider quectel-dial
#       provider ppp-dial


root@i2c6ulxbn:~# ifup ppp0

NDIS拨号方式

首先启用模块的网络接口usb0,然后使用microcom工具,启用NDIS方式拨号,最后获取IP地址。

# ifconfig usb0 up
# microcom /dev/ttyUSB0
at^ndisdup=1,1
OK
# udhcpc -i usb0


网络测速

root@i2c6ulxbn:~# ./speedtest-linux-arm-speed-issues -s 17251
github.com/zpeters/speedtest -- unofficial cli for speedtest.net
Server: 17251 - Guangzhou (ChinaTelecom-GZ)
2018/08/19 12:27:47 Testing download speed
..........
2018/08/19 12:29:25 Testing upload speed
.....
Ping (Lowest): 92.82 ms | Download (Max): 7.51 Mbps | Upload (Max): 11.11 Mbps
# 优先级为LTE > 3G > 2G
AT^SYSCFGEX="00",3FFFFFFF,1,2,7FFFFFFFFFFFFFFF,,

# 查询 SIM 卡是否识别
AT+CPIN?
+CPIN: READY 
  
// 查询信号强度 范围是0~31
AT+CSQ
+CSQ: 17,99 
  
// 查询数据业务可用状态
AT+CEREG?
+CEREG: 0,1
 
// 查询模块注册网络制式
AT^SYSINFOEX
^SYSINFOEX:2,3,0,1,,6,"LTE",101,"LTE"
  
// NDIS拨号
// 查詢网络制式
AT+CGDCONT?
+CGDCONT: 0,"IPV4V6","","",0,0,0,0,0,0
+CGDCONT: 1,"IP","3gwap","",0,0,0,0,0,0
+CGDCONT: 11,"IPV4V6","","",0,0,0,0,0,0
 
// NDIS拨号是否可用
AT^NDISDUP?
OK
 
// 网络拨号
AT^NDISDUP=1,1
OK
 
// 拨号结果,连接成功为1
AT+CGATT?
1 
 
//连接后自动获取IP
udhcpc -i wwan0

NDIS拨号

microcom -s 115200 -p /dev/ttyUSB2 -d -l /tmp/hw.log


AT+CGDCONT?
返回
+CGDCONT: 0,"IPV4V6","","",0,0,0,0,0,0
+CGDCONT: 1,"IP","3gwap","",0,0,0,0,0,0
+CGDCONT: 11,"IPV4V6","","",0,0,0,0,0,0




AT^NDISDUP?
返回
OK




AT^NDISDUP=?
返回
^NDISDUP: (1-11),(0-1)

OK


开始连接
AT^NDISDUP=1,1
返回
OK

ctrl+a+z

udhcpc -i wwan0
#!/bin/sh /etc/rc.common
# Example script
# Copyright (C) 2007 OpenWrt.org
 
 
START=99
STOP=98
 
start() {
        # commands to launch application
        if [ -f /sys/devices/platform/rt3xxx-ehci/usb1/1-1/1-1.2/idProduct ]; then
                idProduct=`sed -n 1p /sys/devices/platform/rt3xxx-ehci/usb1/1-1/1-1.2/idProduct`
                idVendor=`sed -n 1p /sys/devices/platform/rt3xxx-ehci/usb1/1-1/1-1.2/idVendor`
                if [ $? -eq 0  -a  -n "$idProduct" -a "$idProduct" ==  "15c1" -a  -n "$idVendor" -a "$idVendor" ==  "12d1" ]; then
 
                        ifup 4g
                        sleep 1
                        echo -en "AT^SYSCFGEX=\"030201\",3FFFFFFF,0,2,7FFFFFFFFFFFFFFF,,\r\n" > /dev/ttyUSB2
                        sleep 1
                        echo -en "AT+CGDCONT=1,\"IPV4V6\",\"\"\r\n" > /dev/ttyUSB2
                        sleep 1
                        echo -en 'AT^NDISDUP=1,1\r\n' > /dev/ttyUSB2
                fi
        fi
}
 
stop() {
        if [ -f /sys/devices/platform/rt3xxx-ehci/usb1/1-1/1-1.2/idProduct ]; then
                idProduct=`sed -n 1p /sys/devices/platform/rt3xxx-ehci/usb1/1-1/1-1.2/idProduct`
                idVendor=`sed -n 1p /sys/devices/platform/rt3xxx-ehci/usb1/1-1/1-1.2/idVendor`
                if [ $? -eq 0  -a  -n "$idProduct" -a "$idProduct" ==  "15c1" -a  -n "$idVendor" -a "$idVendor" ==  "12d1" ]; then
                        echo -en 'AT^NDISDUP=1,0\r\n' > /dev/ttyUSB2
                        sleep 1
                        ifdown 4g
                fi
        fi
}
  • No labels
Write a comment…