linux 4G模块调试注意事项

本文仅记录自己调试过程碰到的问题,后续有时间的话来完善内容。

1. 检查SIM卡是否插好:AT指令是AT+CPIN?,回复状态READY表示已插好。

2. 检查是否有信号:AT指令是AT+CSQ,回复 xx,99(xx范围0~31,越大信号越好)。

3. 检查SIM卡是否注册:AT指令AT+CGREG?

4. linux平台下PPPD和CHAT脚本文件换行符不能使用windows格式。

5. 查看和添加路由。查看:route -n, 添加:route add default dev ppp0 

下面是一个可用的配置(按照第一行注释存放位置+文件名):

#/etc/ppp/peers/4gnet
# Usage:root>pppd call 4gnet
# Hide password in debug messages
hide-password
# The phone is not required to authenticate
noauth
# The chat script (be sure to edit that file,too!)
connect '/usr/sbin/chat -s -v -f /etc/chatscripts/chat-connect'
# The close script(be sure to edit that file,too!)
disconnect '/usr/sbin/chat -s -v -f /etc/chatscripts/chat-disconnect'
# Debug info from pppd
# debug
# Serial Device to which the HSPDA phone is connected
/dev/ttyUSB3
# Serial port line speed
115200
# If you want to use the HSDPA link as your gateway
defaultroute
# pppd must not propose any IP address to the peer
noipdefault
# No ppp compression
novj
novjccomp
noccp
ipcp-accept-local
ipcp-accept-remote
local
lcp-echo-failure 6
lcp-echo-interval 10
#pppd donot exit limit by 'maxfail'
persist
#0:infinite
#maxfail 0
# For sanity, keep a lock on the serial line
lock
dump
# Keep pppd attached to the terminal
# Comment this to get daemon mode pppd
nodetach
user 
password 
# Hardware flow control
crtscts
remotename 3gppp
ipparam 3gppp
# Ask the peer for up to 2 DNS server addresses
usepeerdns
# /etc/chatsscripts/chat-connect
TIMEOUT 5
ABORT "BUSY"
ABORT "NO CARRIER"
ABORT "NO DIALTONE"
ABORT "ERROR"
ABORT "NO ANSWER"

'' AT
# OK ATI
OK AT+CPIN?
OK AT+CSQ
OK AT+CGREG?
OK ATZ
# OK ATE0
# Connection to the network
OK AT+CGDCONT=1,"IP","3gnet"
# Dial the number
OK ATDT*99#
CONNECT ''
# /etc/chatsscripts/chat-disconnect
ABORT "ERROR"
ABORT "NO DIALTONE"
SAY "\nSending break to the modem\n"
"" +++
"" +++
"" +++
"" ATH
SAY "\nGood bay\n"
#!/bin/sh
# /etc/ppp/if-up.d/0001usepeergw
# chmod a+x 0001usepeergw
route add default dev ppp0

你可能感兴趣的:(4g,linux,运维,服务器)