0

我正在尝试构建一个小型(基于 A20)的服务器,它应该自动连接到互联网(GSM)并永久保持连接。我的设置是:

硬件:

Board: Olimex A20 OlinuXino-Lime2
GSM modem: USB HSDPA (https://www.olimex.com/Products/USB-Modules/MOD-USB3G/)

软件:

debian 10
pppd
pppconfig (pon/poff)
usbmodeswitch

开机后检测到modem并正确切换到Modem(Bus 004 Device 004: ID 12d1:1001 Huawei Technologies Co., Ltd. E161/E169/E620/E800 HSDPA Modem)和/dev/ttyUSB0-2定义。

我设置了一个 systemd 单元,它在 ttyUSB0 可用后启动 pppd 并正确连接到 GSM 提供商:

Jun 14 23:22:13 A20-OLinuXino-HA-001 systemd[1]: Starting pppd daemon on /dev/ttyUSB0...
Jun 14 23:22:13 A20-OLinuXino-HA-001 systemd[1]: Started pppd daemon on /dev/ttyUSB0.
Jun 14 23:22:13 A20-OLinuXino-HA-001 pppd[870]: pppd 2.4.7 started by root, uid 0
Jun 14 23:22:26 A20-OLinuXino-HA-001 pppd[870]: Script /usr/sbin/chat -v -f /etc/chatscripts/keepgo finished (pid 871), status = 0x5
Jun 14 23:22:26 A20-OLinuXino-HA-001 pppd[870]: Connect script failed
Jun 14 23:22:59 A20-OLinuXino-HA-001 pppd[870]: Script /usr/sbin/chat -v -f /etc/chatscripts/keepgo finished (pid 971), status = 0x5
Jun 14 23:22:59 A20-OLinuXino-HA-001 pppd[870]: Connect script failed
Jun 14 23:23:33 A20-OLinuXino-HA-001 pppd[870]: Script /usr/sbin/chat -v -f /etc/chatscripts/keepgo finished (pid 992), status = 0x0
Jun 14 23:23:33 A20-OLinuXino-HA-001 pppd[870]: Serial connection established.
Jun 14 23:23:33 A20-OLinuXino-HA-001 pppd[870]: using channel 1
Jun 14 23:23:33 A20-OLinuXino-HA-001 pppd[870]: Using interface ppp0
Jun 14 23:23:33 A20-OLinuXino-HA-001 pppd[870]: Connect: ppp0 <--> /dev/ttyUSB0
Jun 14 23:23:34 A20-OLinuXino-HA-001 pppd[870]: sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xc63c6af6> <pcomp> <accomp>]
Jun 14 23:23:34 A20-OLinuXino-HA-001 pppd[870]: rcvd [LCP ConfReq id=0x0 <asyncmap 0x0> <auth chap MD5> <magic 0x24d918f4> <pcomp> <accomp>]
Jun 14 23:23:34 A20-OLinuXino-HA-001 pppd[870]: sent [LCP ConfAck id=0x0 <asyncmap 0x0> <auth chap MD5> <magic 0x24d918f4> <pcomp> <accomp>]
Jun 14 23:23:34 A20-OLinuXino-HA-001 pppd[870]: rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0xc63c6af6> <pcomp> <accomp>]
Jun 14 23:23:34 A20-OLinuXino-HA-001 pppd[870]: sent [LCP EchoReq id=0x0 magic=0xc63c6af6]
Jun 14 23:23:34 A20-OLinuXino-HA-001 pppd[870]: rcvd [LCP DiscReq id=0x1 magic=0x24d918f4]
Jun 14 23:23:34 A20-OLinuXino-HA-001 pppd[870]: rcvd [CHAP Challenge id=0x1 <00000000000000000000000000000000>, name = "UMTS_CHAP_SRVR"]
Jun 14 23:23:34 A20-OLinuXino-HA-001 pppd[870]: sent [CHAP Response id=0x1 <7dacccc151c57331186e8771b0dccfb4>, name = "ppp"]
Jun 14 23:23:34 A20-OLinuXino-HA-001 pppd[870]: rcvd [CHAP Success id=0x1 ""]
Jun 14 23:23:34 A20-OLinuXino-HA-001 pppd[870]: CHAP authentication succeeded
Jun 14 23:23:34 A20-OLinuXino-HA-001 pppd[870]: CHAP authentication succeeded
Jun 14 23:23:34 A20-OLinuXino-HA-001 pppd[870]: sent [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15> <bsd v1 15>]
Jun 14 23:23:34 A20-OLinuXino-HA-001 pppd[870]: 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>]
Jun 14 23:23:34 A20-OLinuXino-HA-001 pppd[870]: rcvd [LCP ProtRej id=0x2 80 fd 01 01 00 0f 1a 04 78 00 18 04 78 00 15 03 2f]
Jun 14 23:23:34 A20-OLinuXino-HA-001 pppd[870]: Protocol-Reject for 'Compression Control Protocol' (0x80fd) received
Jun 14 23:23:35 A20-OLinuXino-HA-001 pppd[870]: rcvd [IPCP ConfNak id=0x1 <ms-dns1 10.11.12.13> <ms-dns2 10.11.12.14> <ms-wins 10.11.12.13> <ms-wins 10.11.12.14>]
Jun 14 23:23:35 A20-OLinuXino-HA-001 pppd[870]: sent [IPCP ConfReq id=0x2 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 10.11.12.13> <ms-dns2 10.11.12.14> <ms-wins 10.11.12.13> <ms-wins 10.11.12.14>]
Jun 14 23:23:36 A20-OLinuXino-HA-001 pppd[870]: rcvd [IPCP ConfNak id=0x2 <ms-dns1 10.11.12.13> <ms-dns2 10.11.12.14> <ms-wins 10.11.12.13> <ms-wins 10.11.12.14>]
Jun 14 23:23:36 A20-OLinuXino-HA-001 pppd[870]: sent [IPCP ConfReq id=0x3 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 10.11.12.13> <ms-dns2 10.11.12.14> <ms-wins 10.11.12.13> <ms-wins 10.11.12.14>]
Jun 14 23:23:36 A20-OLinuXino-HA-001 pppd[870]: rcvd [IPCP ConfReq id=0x0]
Jun 14 23:23:36 A20-OLinuXino-HA-001 pppd[870]: sent [IPCP ConfNak id=0x0 <addr 0.0.0.0>]
Jun 14 23:23:36 A20-OLinuXino-HA-001 pppd[870]: rcvd [IPCP ConfRej id=0x3 <compress VJ 0f 01> <ms-wins 10.11.12.13> <ms-wins 10.11.12.14>]
Jun 14 23:23:36 A20-OLinuXino-HA-001 pppd[870]: sent [IPCP ConfReq id=0x4 <addr 0.0.0.0> <ms-dns1 10.11.12.13> <ms-dns2 10.11.12.14>]
Jun 14 23:23:36 A20-OLinuXino-HA-001 pppd[870]: rcvd [IPCP ConfNak id=0x4 <addr 10.136.211.206> <ms-dns1 80.58.61.250> <ms-dns2 80.58.61.254>]
Jun 14 23:23:36 A20-OLinuXino-HA-001 pppd[870]: sent [IPCP ConfReq id=0x5 <addr 10.136.211.206> <ms-dns1 80.58.61.250> <ms-dns2 80.58.61.254>]
Jun 14 23:23:36 A20-OLinuXino-HA-001 pppd[870]: rcvd [IPCP ConfAck id=0x5 <addr 10.136.211.206> <ms-dns1 80.58.61.250> <ms-dns2 80.58.61.254>]
Jun 14 23:23:37 A20-OLinuXino-HA-001 pppd[870]: rcvd [IPCP ConfReq id=0x1]
Jun 14 23:23:37 A20-OLinuXino-HA-001 pppd[870]: sent [IPCP ConfAck id=0x1]
Jun 14 23:23:37 A20-OLinuXino-HA-001 pppd[870]: Could not determine remote IP address: defaulting to 10.64.64.64
Jun 14 23:23:38 A20-OLinuXino-HA-001 pppd[870]: local  IP address 10.136.211.206
Jun 14 23:23:38 A20-OLinuXino-HA-001 pppd[870]: remote IP address 10.64.64.64
Jun 14 23:23:38 A20-OLinuXino-HA-001 pppd[870]: primary   DNS address 80.58.61.250
Jun 14 23:23:38 A20-OLinuXino-HA-001 pppd[870]: secondary DNS address 80.58.61.254
Jun 14 23:23:38 A20-OLinuXino-HA-001 pppd[870]: Script /etc/ppp/ip-up started (pid 1004)
Jun 14 23:23:38 A20-OLinuXino-HA-001 pppd[870]: Script /etc/ppp/ip-up finished (pid 1004), status = 0x0
Jun 14 23:24:04 A20-OLinuXino-HA-001 pppd[870]: sent [LCP EchoReq id=0x1 magic=0xc63c6af6]
Jun 14 23:24:04 A20-OLinuXino-HA-001 pppd[870]: rcvd [LCP EchoRep id=0x1 magic=0x24d918f4 c6 3c 6a f6]
Jun 14 23:24:34 A20-OLinuXino-HA-001 pppd[870]: sent [LCP EchoReq id=0x2 magic=0xc63c6af6]
...

该连接提供对互联网的访问并保持稳定,直到大约 6-7 小时后。然后突然连接丢失并出现以下日志条目:

...    
Jun 15 06:10:21 A20-OLinuXino-HA-001 pppd[870]: sent [LCP EchoReq id=0x2d magic=0xc63c6af6]
Jun 15 06:10:21 A20-OLinuXino-HA-001 pppd[870]: rcvd [LCP EchoRep id=0x2d magic=0x24d918f4 c6 3c 6a f6]
Jun 15 06:10:51 A20-OLinuXino-HA-001 pppd[870]: sent [LCP EchoReq id=0x2e magic=0xc63c6af6]
Jun 15 06:10:51 A20-OLinuXino-HA-001 pppd[870]: rcvd [LCP EchoRep id=0x2e magic=0x24d918f4 c6 3c 6a f6]
Jun 15 06:11:21 A20-OLinuXino-HA-001 pppd[870]: sent [LCP EchoReq id=0x2f magic=0xc63c6af6]
Jun 15 06:11:51 A20-OLinuXino-HA-001 pppd[870]: sent [LCP EchoReq id=0x30 magic=0xc63c6af6]
Jun 15 06:12:21 A20-OLinuXino-HA-001 pppd[870]: sent [LCP EchoReq id=0x31 magic=0xc63c6af6]
Jun 15 06:12:52 A20-OLinuXino-HA-001 pppd[870]: sent [LCP EchoReq id=0x32 magic=0xc63c6af6]
Jun 15 06:13:22 A20-OLinuXino-HA-001 pppd[870]: No response to 4 echo-requests
Jun 15 06:13:22 A20-OLinuXino-HA-001 pppd[870]: Serial link appears to be disconnected.
Jun 15 06:13:22 A20-OLinuXino-HA-001 pppd[870]: Connect time 409.8 minutes.
Jun 15 06:13:22 A20-OLinuXino-HA-001 pppd[870]: Sent 1067449 bytes, received 7513038 bytes.
Jun 15 06:13:22 A20-OLinuXino-HA-001 pppd[870]: Script /etc/ppp/ip-down started (pid 1938)
Jun 15 06:13:22 A20-OLinuXino-HA-001 pppd[870]: sent [LCP TermReq id=0x2 "Peer not responding"]
Jun 15 06:13:22 A20-OLinuXino-HA-001 pppd[870]: Script /etc/ppp/ip-down finished (pid 1938), status = 0x0
Jun 15 06:13:25 A20-OLinuXino-HA-001 pppd[870]: sent [LCP TermReq id=0x3 "Peer not responding"]
Jun 15 06:13:28 A20-OLinuXino-HA-001 pppd[870]: Connection terminated.

停止连接后,除了重新启动系统外,无法再次启动它。在尝试重新启动连接(pon)之前,我已经尝试过 poff,killall -9 pppd。尝试重新启动失败并显示以下消息:设备 ttyUSB0 被 pid xxxx 锁定(似乎是 pppd)

我的 /etc/ppp/peers/provider(由 pppconfig 生成)是:

hide-password 
noauth
connect "/usr/sbin/chat -v -f /etc/chatscripts/MyProvider"
debug
/dev/ttyUSB0
460800
defaultroute
noipdefault 
user "ppp"
remotename xxxx
ipparam xxxx

persist
usepeerdns

我迷路了,尝试了很多事情(甚至完全重建服务器)都无济于事。我非常感谢任何帮助解决这个问题。

4

0 回答 0