====== マルチキャリア対応 SIM を使用した LTE 接続設定 ====== \\ MA-S1xx v5.4.0, MA-E3xx v5.3.0, MA-X3xx v6.0.0 から、マルチキャリア対応 SIM (SORACOM planX1, planX3 など) での自動キャリア変更機能に対応しました。 [参考] [[https://blog.soracom.com/ja-jp/2022/08/18/multi-carrier-failover-example/|マルチキャリアに対応する SIM のキャリア切り替えの実装例 - SORACOM 公式ブログ]] \\ ===== 設定 ===== WebUI にメインとして使用するキャリアと、バックアップに使用するキャリア 2 つの PLMN を設定します。 {{:mas1xx_ope:setup_multi_profile_sim_ppp:multi-carrier-sim-sb-kddi_00.png|Setup Primary-PLMN, Secondary-PLMN}} ※ キャリア切替のトリガーとして使用する、ICMP による Peer ((LTE通信の経路上で応答するホップ数が最小のアドレス))への疎通確認機能は**強制的に有効化**されます。 \\ ===== 動作確認 ===== 疎通確認((LTE通信の経路上で応答するホップ数が最小のアドレスを対象にPingを送信)) NG が 3 回連続すると、PPP 接続を切断してメイン回線からバックアップ回線への切替が行われます。 ※ **意図的に**疎通確認 NG を発生させるため、今回は PPP 接続完了後に iptables で ppp0 からのパケットを落とす設定をしています。 * PPP 受信パケットを全部落とす iptables -I INPUT -i ppp0 -j DROP * 上記フィルター設定を消して元に戻す iptables -D INPUT 1 \\ ==== メイン回線接続 ==== Nov 2 09:08:04 gemini systemd[1]: Starting PPP Manager... Nov 2 09:08:04 gemini systemd[1]: Started PPP Manager. Nov 2 09:08:04 gemini PPP Manager[814]: Started. Nov 2 09:08:04 gemini PPP Manager[814]: Wait for device: /dev/ttyAML0 ... Nov 2 09:08:04 gemini PPP Manager[814]: LTE module found, check config/status. Nov 2 09:08:04 gemini PPP Manager[814]: SIM is ready. Nov 2 09:08:04 gemini PPP Manager[814]: Use Primary(Single) PLMN: 44020 <------- Softbank で接続 Nov 2 09:08:04 gemini PPP Manager[814]: Current CarrierID: 4 (SIM Free) Nov 2 09:08:04 gemini PPP Manager[814]: Detached from current Network. Nov 2 09:08:04 gemini PPP Manager[814]: PLMN set to 44020, wait (max 30 seconds)... Nov 2 09:08:10 gemini PPP Manager[814]: Set PLMN[44020]: succeeded. Nov 2 09:08:10 gemini PPP Manager[814]: No need to set PDP Context (Same APN: soracom.io). Nov 2 09:08:10 gemini pppd[815]: pppd 2.4.7 started by root, uid 0 Nov 2 09:08:11 gemini chat_ng[817]: LTE Module: AML574 Nov 2 09:08:11 gemini chat_ng[817]: Module Firmware: 14-12. Nov 2 09:08:11 gemini chat_ng[817]: SIM is Ready. Nov 2 09:08:11 gemini chat_ng[817]: SIM IMSI: 29510xxxxxxxxxx. Nov 2 09:08:11 gemini chat_ng[817]: Antenna Level: RSSI: -55.0 [dBm] (Level: 3) Nov 2 09:08:11 gemini chat_ng[817]: Wait for attaching to LTE Network... Nov 2 09:08:11 gemini chat_ng[817]: Attached to LTE Network? Yes Nov 2 09:08:11 gemini chat_ng[817]: Start dialing... Nov 2 09:08:11 gemini chat_ng[817]: Connected. Nov 2 09:08:12 gemini pppd[815]: Script /usr/local/sbin/chat_ng -n -f /etc/default/ppp finished (pid 816), status = 0x0 Nov 2 09:08:12 gemini pppd[815]: Serial connection established. Nov 2 09:08:12 gemini pppd[815]: using channel 1 Nov 2 09:08:12 gemini pppd[815]: Using interface ppp0 Nov 2 09:08:12 gemini pppd[815]: Connect: ppp0 <--> /dev/ttyAML0 Nov 2 09:08:13 gemini pppd[815]: sent [LCP ConfReq id=0x1 ] Nov 2 09:08:13 gemini pppd[815]: rcvd [LCP ConfReq id=0x0 ] Nov 2 09:08:13 gemini pppd[815]: sent [LCP ConfAck id=0x0 ] Nov 2 09:08:13 gemini pppd[815]: rcvd [LCP ConfAck id=0x1 ] Nov 2 09:08:13 gemini pppd[815]: sent [LCP EchoReq id=0x0 magic=0x8e1b327a] Nov 2 09:08:13 gemini pppd[815]: rcvd [LCP DiscReq id=0x1 magic=0x7555412d] Nov 2 09:08:13 gemini pppd[815]: rcvd [CHAP Challenge id=0x1 <98343e1d263eb715bbb18a65b3f56ae6>, name = "UMTS_CHAP_SRVR"] Nov 2 09:08:13 gemini pppd[815]: sent [CHAP Response id=0x1 <61151b4f63cd6af175331dba7e6ad1af>, name = "sora"] Nov 2 09:08:13 gemini pppd[815]: rcvd [LCP EchoRep id=0x0 magic=0x7555412d 8e 1b 32 7a] Nov 2 09:08:13 gemini pppd[815]: rcvd [CHAP Success id=0x1 ""] Nov 2 09:08:13 gemini pppd[815]: CHAP authentication succeeded Nov 2 09:08:13 gemini pppd[815]: CHAP authentication succeeded Nov 2 09:08:13 gemini pppd[815]: sent [IPCP ConfReq id=0x1 ] Nov 2 09:08:13 gemini pppd[815]: rcvd [IPCP ConfReq id=0x0] Nov 2 09:08:13 gemini pppd[815]: sent [IPCP ConfNak id=0x0 ] Nov 2 09:08:13 gemini pppd[815]: rcvd [IPCP ConfNak id=0x1 ] Nov 2 09:08:13 gemini pppd[815]: sent [IPCP ConfReq id=0x2 ] Nov 2 09:08:13 gemini pppd[815]: rcvd [IPCP ConfReq id=0x1] Nov 2 09:08:13 gemini pppd[815]: sent [IPCP ConfAck id=0x1] Nov 2 09:08:13 gemini pppd[815]: rcvd [IPCP ConfAck id=0x2 ] Nov 2 09:08:13 gemini pppd[815]: Could not determine remote IP address: defaulting to 10.64.64.64 Nov 2 09:08:13 gemini PPP Manager[814]: PPP connected. Nov 2 09:08:13 gemini pppd[815]: replacing old default route to eth0 [172.16.1.60] Nov 2 09:08:13 gemini pppd[815]: local IP address 10.173.122.34 Nov 2 09:08:13 gemini pppd[815]: remote IP address 10.64.64.64 Nov 2 09:08:13 gemini pppd[815]: primary DNS address 100.127.0.53 Nov 2 09:08:13 gemini pppd[815]: secondary DNS address 100.127.1.53 Nov 2 09:08:13 gemini pppd[815]: Script /etc/ppp/ip-up started (pid 822) Nov 2 09:08:14 gemini pppd[815]: Script /etc/ppp/ip-up finished (pid 822), status = 0x0 Nov 2 09:08:15 gemini ntpd[537]: Listen normally on 6 ppp0 10.173.122.34:123 Nov 2 09:08:15 gemini ntpd[537]: new interface(s) found: waking up resolver \\ ==== 疎通確認 NG ==== Nov 2 09:08:44 gemini PPP Manager[814]: LTE next-hop address: 54.150.128.67 <--- これは疎通確認 OK Nov 2 09:09:16 gemini PPP Manager[814]: ! LTE peer not responding, count: 1 Nov 2 09:09:48 gemini PPP Manager[814]: ! LTE peer not responding, count: 2 Nov 2 09:10:20 gemini PPP Manager[814]: ! LTE peer not responding, count: 3 \\ ==== PPP 切断 ==== Nov 2 09:10:20 gemini PPP Manager[814]: Wait holdoff time, 5 [sec] Nov 2 09:10:20 gemini pppd[815]: Terminating on signal 15 Nov 2 09:10:20 gemini pppd[815]: Connect time 2.2 minutes. Nov 2 09:10:20 gemini pppd[815]: Sent 116 bytes, received 224 bytes. Nov 2 09:10:20 gemini pppd[815]: restoring old default route to eth0 [172.16.1.60] Nov 2 09:10:20 gemini pppd[815]: Script /etc/ppp/ip-down started (pid 912) Nov 2 09:10:20 gemini pppd[815]: sent [LCP TermReq id=0x2 "User request"] Nov 2 09:10:20 gemini pppd[815]: rcvd [LCP TermAck id=0x2] Nov 2 09:10:20 gemini pppd[815]: Connection terminated. Nov 2 09:10:21 gemini pppd[815]: Script /etc/ppp/ip-down finished (pid 912), status = 0x0 Nov 2 09:10:21 gemini pppd[815]: Exit. Nov 2 09:10:22 gemini ntpd[537]: Deleting interface #6 ppp0, 10.173.122.34#123, interface stats: received=0, sent=0, dropped=0, active_time=127 secs \\ ==== キャリアを切り替えて PPP 接続 ==== Nov 2 09:10:25 gemini PPP Manager[814]: SIM is ready. Nov 2 09:10:25 gemini PPP Manager[814]: Use Secondary PLMN: 44051 <------------------ KDDI Nov 2 09:10:25 gemini PPP Manager[814]: Current CarrierID: 4 (SIM Free) Nov 2 09:10:25 gemini PPP Manager[814]: Detached from current Network. Nov 2 09:10:25 gemini PPP Manager[814]: PLMN set to 44051, wait (max 30 seconds)... Nov 2 09:10:31 gemini PPP Manager[814]: Set PLMN[44051]: succeeded. Nov 2 09:10:31 gemini PPP Manager[814]: No need to set PDP Context (Same APN: soracom.io). Nov 2 09:10:31 gemini pppd[980]: pppd 2.4.7 started by root, uid 0 Nov 2 09:10:32 gemini chat_ng[982]: LTE Module: AML574 Nov 2 09:10:32 gemini chat_ng[982]: Module Firmware: 14-12. Nov 2 09:10:32 gemini chat_ng[982]: SIM is Ready. Nov 2 09:10:32 gemini chat_ng[982]: SIM IMSI: 29510xxxxxxxxxx. Nov 2 09:10:32 gemini chat_ng[982]: Antenna Level: RSSI: -71.0 [dBm] (Level: 3) Nov 2 09:10:32 gemini chat_ng[982]: Wait for attaching to LTE Network... Nov 2 09:10:32 gemini chat_ng[982]: Attached to LTE Network? Yes Nov 2 09:10:32 gemini chat_ng[982]: Start dialing... Nov 2 09:10:33 gemini chat_ng[982]: Connected. Nov 2 09:10:34 gemini pppd[980]: Script /usr/local/sbin/chat_ng -n -f /etc/default/ppp finished (pid 981), status = 0x0 Nov 2 09:10:34 gemini pppd[980]: Serial connection established. Nov 2 09:10:34 gemini pppd[980]: using channel 2 Nov 2 09:10:34 gemini pppd[980]: Using interface ppp0 Nov 2 09:10:34 gemini pppd[980]: Connect: ppp0 <--> /dev/ttyAML0 Nov 2 09:10:35 gemini pppd[980]: sent [LCP ConfReq id=0x1 ] Nov 2 09:10:35 gemini pppd[980]: rcvd [LCP ConfReq id=0x2 ] Nov 2 09:10:35 gemini pppd[980]: sent [LCP ConfAck id=0x2 ] Nov 2 09:10:35 gemini pppd[980]: rcvd [LCP ConfAck id=0x1 ] Nov 2 09:10:35 gemini pppd[980]: sent [LCP EchoReq id=0x0 magic=0xffe5a45b] Nov 2 09:10:35 gemini pppd[980]: rcvd [LCP DiscReq id=0x3 magic=0x7557695a] Nov 2 09:10:35 gemini pppd[980]: rcvd [CHAP Challenge id=0x1 <2b7ca633c55482de7d22115061c1e3b6>, name = "UMTS_CHAP_SRVR"] Nov 2 09:10:35 gemini pppd[980]: sent [CHAP Response id=0x1 <1c97bc057c16a41ab99b290c9c0d52f6>, name = "sora"] Nov 2 09:10:35 gemini pppd[980]: rcvd [LCP EchoRep id=0x0 magic=0x7557695a ff e5 a4 5b] Nov 2 09:10:35 gemini pppd[980]: rcvd [CHAP Success id=0x1 ""] Nov 2 09:10:35 gemini pppd[980]: CHAP authentication succeeded Nov 2 09:10:35 gemini pppd[980]: CHAP authentication succeeded Nov 2 09:10:35 gemini pppd[980]: sent [IPCP ConfReq id=0x1 ] Nov 2 09:10:35 gemini pppd[980]: rcvd [IPCP ConfReq id=0x2] Nov 2 09:10:35 gemini pppd[980]: sent [IPCP ConfNak id=0x2 ] Nov 2 09:10:35 gemini pppd[980]: rcvd [IPCP ConfNak id=0x1 ] Nov 2 09:10:35 gemini pppd[980]: sent [IPCP ConfReq id=0x2 ] Nov 2 09:10:35 gemini pppd[980]: rcvd [IPCP ConfReq id=0x3] Nov 2 09:10:35 gemini pppd[980]: sent [IPCP ConfAck id=0x3] Nov 2 09:10:35 gemini pppd[980]: rcvd [IPCP ConfAck id=0x2 ] Nov 2 09:10:35 gemini pppd[980]: Could not determine remote IP address: defaulting to 10.64.64.64 Nov 2 09:10:35 gemini PPP Manager[814]: PPP connected. Nov 2 09:10:35 gemini pppd[980]: replacing old default route to eth0 [172.16.1.60] Nov 2 09:10:35 gemini pppd[980]: local IP address 10.173.122.34 Nov 2 09:10:35 gemini pppd[980]: remote IP address 10.64.64.64 Nov 2 09:10:35 gemini pppd[980]: primary DNS address 100.127.0.53 Nov 2 09:10:35 gemini pppd[980]: secondary DNS address 100.127.1.53 Nov 2 09:10:35 gemini pppd[980]: Script /etc/ppp/ip-up started (pid 991) Nov 2 09:10:36 gemini pppd[980]: Script /etc/ppp/ip-up finished (pid 991), status = 0x0 Nov 2 09:10:36 gemini ntpd[537]: Listen normally on 7 ppp0 10.173.122.34:123 Nov 2 09:10:36 gemini ntpd[537]: new interface(s) found: waking up resolver