我正在尝试构建一个微型(基于 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
启动后,检测到调制解调器并正确切换到调制解调器模式(总线 004 设备 004:ID12d1:1001华为技术有限公司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.
停止连接后,除了重新启动系统外,没有其他方法可以重新启动它。我尝试过 poff、killall -9 pppd,然后尝试重新启动连接 (pon)。尝试重新启动失败,并显示以下消息:设备 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
我迷路了,尝试了很多方法(甚至彻底重建服务器)但都无济于事。如果能帮助解决这个问题,我将不胜感激。
麦克风
[Stackoverflow 上也提出了这个问题,但是没有回复]
答案1
我注意到我使用的某个调制解调器设备也发生了类似的事件,但我的设置与您的非常不同。
主要错误点是系统板过热,导致 USB 连接的端口在随机时间(主要是在电源循环期间)断开并重新连接。
在重新连接循环中,系统尝试在线更新 USB 设备驱动程序。但互联网连接中断导致更新尝试失败。这又导致重新连接后无法在系统上注册设备。
我已禁用自动在线更新设备驱动程序的尝试,看看是否能解决问题。
以下是链接如何在 Ubuntu 上禁用自动更新。 https://www.omgubuntu.co.uk/2016/02/how-to-disable-automatic-update-ubuntu