微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

PPPD 连接在启动后几秒钟内停止工作

如何解决PPPD 连接在启动后几秒钟内停止工作

一个通过 UART 连接 SIM7000E GSM 模块的 RaspBerry PI 3B+ 设备。 目标是配置 pppd 以从 RaspBerry PI 访问 Internet。

问题定义: PPPD通过下面提供的配置成功建立与移动网络的连接,因此树莓派可以上网,可以ping通互联网上的各种域名。但是,此连接仅工作 1-2 几十秒,然后无法访问 Internet。无论 Internet 访问不可用,连接仍然存在一段时间。

/etc/ppp/peers/gprs文件内容

user "congstar"
password "cs"

connect "/usr/sbin/chat -v -f /etc/chatscripts/pap -T *99#"

# Serial device to which the modem is connected.
/dev/ttyAMA0

# Baudrate
115200

nocrtscts

debug

nodetach
ipcp-accept-local
ipcp-accept-remote

# Assumes that your IP address is allocated dynamically by the ISP.
noipdefault
# Try to get the name server addresses from the ISP.
usepeerdns
# Use this connection as the default route.
defaultroute

# Replaces the default route
replacedefaultroute

# Makes pppd "dial again" when the connection is lost.
persist

# Do not ask the remote to authenticate.
noauth

/etc/chatscripts/pap 文件内容

#REPORT         CONNECT
ABORT           BUSY
ABORT           VOICE
ABORT           "NO CARRIER"
ABORT           "NO DIALTONE"
ABORT           "NO DIAL TONE"
""              ATZ
OK              AT+CGDCONT=1,"IP","internet.telekom","0.0.0.0",0
OK              ATDT\T
CONNECT         ""

我使用以下命令运行 pppd 进程:

pppd call gprs

它给出了以下输出

Script /usr/sbin/chat -v -f /etc/chatscripts/pap -T *99# finished (pid 466),status = 0x0
Serial connection established.
using channel 1
Using interface ppp0
Connect: ppp0 <--> /dev/ttyAMA0
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xfa266a86> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x0 <asyncmap 0x0> <auth chap MD5> <magic 0xd0837b0a> <pcomp> <accomp>]
sent [LCP ConfAck id=0x0 <asyncmap 0x0> <auth chap MD5> <magic 0xd0837b0a> <pcomp> <accomp>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0xfa266a86> <pcomp> <accomp>]
sent [LCP EchoReq id=0x0 magic=0xfa266a86]
rcvd [LCP discReq id=0x1 magic=0xd0837b0a]
rcvd [CHAP Challenge id=0x1 <ed30b6a62ef9f9424e0827f63f5233c0>,name = "umts_CHAP_SRVR"]
sent [CHAP Response id=0x1 <e1b557afa30e21d98517993f053097de>,name = "congstar"]
rcvd [LCP EchoRep id=0x0 magic=0xd0837b0a fa 26 6a 86]
rcvd [CHAP Success id=0x1 ""]
CHAP authentication succeeded
CHAP authentication succeeded
sent [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15> <bsd v1 15>]
sent [IPCP ConfReq id=0x1 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
rcvd [LCP ProtRej id=0x2 80 fd 01 01 00 0f 1a 04 78 00 18 04 78 00 15 03 2f]
Protocol-Reject for 'Compression Control Protocol' (0x80fd) received
rcvd [IPCP ConfReq id=0x0]
sent [IPCP ConfNak id=0x0 <addr 0.0.0.0>]
rcvd [IPCP ConfRej id=0x1 <compress VJ 0f 01>]
sent [IPCP ConfReq id=0x2 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
rcvd [IPCP ConfReq id=0x1]
sent [IPCP ConfAck id=0x1]
rcvd [IPCP ConfNak id=0x2 <addr 10.30.47.58> <ms-dns1 10.74.210.210> <ms-dns2 10.74.210.211>]
sent [IPCP ConfReq id=0x3 <addr 10.30.47.58> <ms-dns1 10.74.210.210> <ms-dns2 10.74.210.211>]
rcvd [IPCP ConfAck id=0x3 <addr 10.30.47.58> <ms-dns1 10.74.210.210> <ms-dns2 10.74.210.211>]
Could not determine remote IP address: defaulting to 10.64.64.64
local  IP address 10.30.47.58
remote IP address 10.64.64.64
primary   DNS address 10.74.210.210
secondary DNS address 10.74.210.211
Script /etc/ppp/ip-up started (pid 473)
Script /etc/ppp/ip-up finished (pid 473),status = 0x0


No response to 4 echo-requests
Serial link appears to be disconnected.
Connect time 1683.8 minutes.
Sent 11846 bytes,received 2597 bytes.
Script /etc/ppp/ip-down started (pid 644)
sent [LCP TermReq id=0x2 "Peer not responding"]
Script /etc/ppp/ip-down finished (pid 644),status = 0x0
sent [LCP TermReq id=0x3 "Peer not responding"]
Connection terminated.
Modem hangup

不得不提

  1. 仅当 GSM 模块通过 UART 连接到 RaspBerry PI 时才会发生上述行为! 当 GSM 调制解调器通过 USB 连接到 RaspBerry PI 时,一切正常使用相同的配置(在这种情况下,使用 /dev/ttyUSB2 代替 /dev/ttyAMA0 ) 并且未观察到所描述的问题。
  2. RaspBerry PI 使用主 UART /dev/ttyAMA0。它被配置为不使用自动波特率功能
  3. 使用了 Raspbian 10,它在内核中支持 PPP。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。