linux 4G模块拨号脚本

关于4G模块的移植,请参考上一节

https://www.cnblogs.com/ChenChangXiong/p/10852177.html

ppp脚本,主要包含3个脚本文件,一个是需要pppd调用的脚本,还有一个chat是运营商的拨号脚本

// 在文件系统的 /etc 目录下,创建 ppp 目录  在 /etc/ppp 目录下创建 peers 目录

gprs脚本:

# vim /etc/ppp/peers/gprs
#/etc/ppp/peers/gprs
# This is pppd script for China Mobile, used GPRS Module
# Usage: root>pppd call gprs
/dev/ttyUSB0
115200
nocrtscts
modem
#noauth
debug
#nodetach
#hide-password
usepeerdns
noipdefault
defaultroute
user "cmnet"
0.0.0.0:0.0.0.0
ipcp-accept-local
#ipcp-accept-remote
#lcp-echo-failure 12
#lcp-echo-interval 3
#noccp
#novj
#novjccomp
#persist
#connect '/usr/sbin/chat -s -v -f /etc/ppp/gprs-connect-chat'
connect '/usr/sbin/chat -v -s -f /etc/ppp/gprs-connect-chat'
#disconnect '/bin/chat -v -f /etc/ppp/gprs-disconnect-chat'

另一个脚本


# vim etc/ppp/chap-secrets
# Secrets for authentication using CHAP
# client server secret IP addresses
"cmnet" * "cmnet" *

拨号脚本:

终端输入:vim   /etc/ppp/gprs-connect-chat

移动: 

#Chat script for China Mobile, used SIMCOM sim4100 TD module.
TIMEOUT 15
ABORT "DELAYED"
ABORT "BUSY"
ABORT "ERROR"
ABORT "NO DIALTONE"
ABORT "NO CARRIER"
TIMEOUT 40
'' \rAT
OK ATS0=0
OK ATE0V1
OK AT+CGDCONT=1,"IP","CMNET"
OK AT+CGEQREQ=1,2,128,384,,,0,,,,,,
OK ATDT*99*1#
CONNECT

联通:
TIMEOUT 5
ABORT 'NO CARRIER'
ABORT 'ERROR'
ABORT 'NODIALTONE'
ABORT 'BUSY'
ABORT 'NO ANSWER'
'' \rAT
OK \rATZ
OK \rAT+CGDCONT=1,"IP","3GNET",,0,0
OK-AT-OK ATDT*99#
CONNECT \d\c

关于脚本的详细解释,请参考: https://blog.csdn.net/duloveding/article/details/8287758

https://www.linuxidc.com/Linux/2011-03/33430p2.htm  (三大运营商的脚本)

脚本设置好后,重启。

首先尝试和模块通信,查看知否正常。

终端输入:

echo    “AT+CSQ”  > /dev/ttyUSB2

然后:cat    /dev/ttyUSB2  

就可以查看信号强度,如果连接正常,就会收到回复,也可以试试其他的指令

如果都正常,最后启动拨号:

ping一下谷歌:

参考文档:

http://www.cnblogs.com/chenfulin5/p/6951290.html?tdsourcetag=s_pcqq_aiomsg

https://blog.csdn.net/duloveding/article/details/8287758

https://www.linuxidc.com/Linux/2011-03/33430p2.htm

https://blog.csdn.net/duloveding/article/details/8287758

https://www.linuxidc.com/Linux/2011-03/33430p2.htm

https://www.v2ex.com/t/328730

https://blog.csdn.net/skdkjzz/article/details/22209371 

https://blog.csdn.net/qq_41546323/article/details/78930780

https://blog.csdn.net/szhebin/article/details/81114566 (有一个文档可以下载参考 关于i.mux6移植)

注意:天线也很重要,一开始我以为不需要天线也可以,顶多是信号差一点,但是实际上,没有天线是不行的,我试的根本无法启动拨号,所以一直的时候ifconfgi没有获取到ip   ME909s天线接在标有M的接口,有三个的天线接在标有M端口的  

猜你喜欢

转载自www.cnblogs.com/ChenChangXiong/p/10854793.html