公司一IOT设备在比例时使用移远EC25-E拨号联网时候发生异常,特将解决方法记录如下
情况说明
操作系统:ubuntu14
通过SSH登录发现拨号一切正常,ifconfig也正常,但就ping外网就不同。
user1@pc:~$ /usr/sbin/pppd call quectel-ppp
pppd options in effect:
debug # (from /etc/ppp/peers/quectel-ppp)
nodetach # (from /etc/ppp/peers/quectel-ppp)
dump # (from /etc/ppp/peers/quectel-ppp)
noauth # (from /etc/ppp/peers/quectel-ppp)
user user1 # (from /etc/ppp/peers/quectel-ppp)
password ?????? # (from /etc/ppp/peers/quectel-ppp)
remotename 3gppp # (from /etc/ppp/peers/quectel-ppp)
/dev/ttyUSB3 # (from /etc/ppp/peers/quectel-ppp)
115200 # (from /etc/ppp/peers/quectel-ppp)
lock # (from /etc/ppp/peers/quectel-ppp)
connect chat -s -v -f /etc/ppp/peers/quectel-chat-connect # (from /etc/ppp/peers/quectel-ppp)
disconnect chat -s -v -f /etc/ppp/peers/quectel-chat-disconnect # (from /etc/ppp/peers/quectel-ppp)
nocrtscts # (from /etc/ppp/peers/quectel-ppp)
modem # (from /etc/ppp/peers/quectel-ppp)
asyncmap 0 # (from /etc/ppp/options)
lcp-echo-failure 4 # (from /etc/ppp/options)
lcp-echo-interval 30 # (from /etc/ppp/options)
hide-password # (from /etc/ppp/peers/quectel-ppp)
novj # (from /etc/ppp/peers/quectel-ppp)
novjccomp # (from /etc/ppp/peers/quectel-ppp)
ipcp-accept-local # (from /etc/ppp/peers/quectel-ppp)
ipcp-accept-remote # (from /etc/ppp/peers/quectel-ppp)
ipparam 3gppp # (from /etc/ppp/peers/quectel-ppp)
noipdefault # (from /etc/ppp/peers/quectel-ppp)
ipcp-max-failure 30 # (from /etc/ppp/peers/quectel-ppp)
defaultroute # (from /etc/ppp/peers/quectel-ppp)
usepeerdns # (from /etc/ppp/peers/quectel-ppp)
noccp # (from /etc/ppp/peers/quectel-ppp)
noipx # (from /etc/ppp/options)
Removed stale lock on ttyUSB3 (pid 20144)
abort on (BUSY)
abort on (NO CARRIER)
abort on (NO DIALTONE)
abort on (ERROR)
abort on (NO ANSWER)
timeout set to 30 seconds
send (AT^M)
expect (OK)
^M
OK
-- got it
send (ATE0^M)
expect (OK)
^M
^M
OK
-- got it
send (ATI;+CSUB;+CSQ;+CPIN?;+COPS?;+CGREG?;&D2^M)
expect (OK)
^M
^M
Quectel^M
EC25^M
Revision: EC25EFAR08A02M4G^M
^M
SubEdition: V03^M
^M
+CSQ: 18,99^M
^M
+CPIN: READY^M
^M
+COPS: 0,0,"Proximus",7^M
^M
+CGREG: 0,1^M
^M
OK
-- got it
send (AT+CGDCONT=1,"IP","3gnet",,0,0^M)
expect (OK)
^M
^M
OK
-- got it
send (ATD*99#^M)
expect (CONNECT)
^M
^M
CONNECT
-- got it
Script chat -s -v -f /etc/ppp/peers/quectel-chat-connect finished (pid 6551), status = 0x0
Serial connection established.
using channel 172
Using interface ppp0
Connect: ppp0 <--> /dev/ttyUSB3
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xc92c634b> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x54 <asyncmap 0x0> <auth chap MD5> <magic 0x15f14d9b> <pcomp> <accomp>]
sent [LCP ConfAck id=0x54 <asyncmap 0x0> <auth chap MD5> <magic 0x15f14d9b> <pcomp> <accomp>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0xc92c634b> <pcomp> <accomp>]
sent [LCP EchoReq id=0x0 magic=0xc92c634b]
rcvd [LCP DiscReq id=0x55 magic=0x15f14d9b]
rcvd [CHAP Challenge id=0x1 <1f26b7f2d35abcc2f1118278e10ff357>, name = "UMTS_CHAP_SRVR"]
sent [CHAP Response id=0x1 <4ff32807f46a0036d49e11ecee76dd36>, name = "linkmiao"]
rcvd [LCP EchoRep id=0x0 magic=0x15f14d9b c9 2c 63 4b]
rcvd [CHAP Success id=0x1 ""]
CHAP authentication succeeded
CHAP authentication succeeded
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
rcvd [IPCP ConfReq id=0x54]
sent [IPCP ConfNak id=0x54 <addr 0.0.0.0>]
rcvd [IPCP ConfNak id=0x1 <addr 100.68.164.240> <ms-dns1 80.201.237.238> <ms-dns2 80.201.237.239>]
sent [IPCP ConfReq id=0x2 <addr 100.68.164.240> <ms-dns1 80.201.237.238> <ms-dns2 80.201.237.239>]
rcvd [IPCP ConfReq id=0x55]
sent [IPCP ConfAck id=0x55]
rcvd [IPCP ConfAck id=0x2 <addr 100.68.164.240> <ms-dns1 80.201.237.238> <ms-dns2 80.201.237.239>]
Could not determine remote IP address: defaulting to 10.64.64.64
not replacing existing default route via 192.168.1.1
local IP address 100.68.164.240
remote IP address 10.64.64.64
primary DNS address 80.201.237.238
secondary DNS address 80.201.237.239
Script /etc/ppp/ip-up started (pid 7028)
Script /etc/ppp/ip-up finished (pid 7028), status = 0x0
ifconfig执行结果
eth8 Link encap:Ethernet HWaddr e4:3a:6e:45:fb:a7
inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::e63a:6eff:fe45:fba7/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:6043 errors:0 dropped:0 overruns:0 frame:0
TX packets:11407 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:583980 (583.9 KB) TX bytes:1078142 (1.0 MB)
Memory:df000000-df01ffff
eth9 Link encap:Ethernet HWaddr e4:3a:6e:45:fb:a6
inet addr:192.168.0.99 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::e63a:6eff:fe45:fba6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:13131337 errors:0 dropped:0 overruns:0 frame:0
TX packets:111 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2206063752 (2.2 GB) TX bytes:16404 (16.4 KB)
Memory:df100000-df11ffff
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:112532425 errors:0 dropped:0 overruns:0 frame:0
TX packets:112532425 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:273738899400 (273.7 GB) TX bytes:273738899400 (273.7 GB)
ppp0 Link encap:Point-to-Point Protocol
inet addr:100.68.164.240 P-t-P:10.64.64.64 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:251 errors:0 dropped:0 overruns:0 frame:0
TX packets:1896 errors:0 dropped:0 overruns:0 carrier:0
ip route show
9a708d71e3be8468bca7806081eaf94.jpg
解决思路
最后详细查看拨号日志才发现APN设置有问题,值为“3gnet” 3gnet的为中国联通的APN,那么现在使用的SIM卡运营商为“Proximus”,查资料得知此SIM卡运营商的APN为:internet.proximus.be 。具体修改如下(文件:/etc/ppp/peers/quectel-chat-connect):
# /etc/ppp/peers/quectel-chat-connect
ABORT "BUSY"
ABORT "NO CARRIER"
ABORT "NO DIALTONE"
ABORT "ERROR"
ABORT "NO ANSWER"
TIMEOUT 30
"" AT
OK ATE0
OK ATI;+CSUB;+CSQ;+CPIN?;+COPS?;+CGREG?;&D2
# Insert the APN provided by your network operator, default apn is 3gnet
OK AT+CGDCONT=1,"IPV4V6","internet.proximus.be ",,0,0
OK ATD*99#
CONNECT
重新拨号后再次ping外网一切正常。
相关命令
cat /dev/ttyUSB3 &
#查询SIM卡状态
echo -en "at+cpin?\r\n" > /dev/ttyUSB2
#设定电话机能关
echo -en "at+cfun=0\r\n" > /dev/ttyUSB2
#设定电话机能开
echo -en "at+cfun=1\r\n" > /dev/ttyUSB2
#获取SIM卡APN
echo -en "at+cgdcont?\r\n" > /dev/ttyUSB3
网友评论