GSM(SIM900a) 모듈을 사용하여 Raspberry Pi 3(Raspbian)에서 인터넷 연결을 설정하고 이를 RXD/TXD 직렬 포트(/dev/ttyS0)에 연결하려고 합니다. IP 주소와 DNS를 얻었습니다. 하지만 어떤 호스트에도 핑을 보낼 수 없으니 라우팅 문제인 것 같아요.
내가 놓친 것은 iptables 규칙일 수도 있습니다. POSTROUTING MASQUERADE와 관련된 것입니까? 나는 전혀 모른다 ...
/var/log/messages의 ppp 출력:
Oct 18 22:09:35 NULL chat[1277]: abort on (BUSY)
Oct 18 22:09:35 NULL chat[1277]: abort on (NO CARRIER)
Oct 18 22:09:35 NULL chat[1277]: abort on (VOICE)
Oct 18 22:09:35 NULL chat[1277]: abort on (NO DIALTONE)
Oct 18 22:09:35 NULL chat[1277]: abort on (NO DIAL TONE)
Oct 18 22:09:35 NULL chat[1277]: abort on (NO ANSWER)
Oct 18 22:09:35 NULL chat[1277]: abort on (DELAYED)
Oct 18 22:09:35 NULL chat[1277]: report (CONNECT)
Oct 18 22:09:35 NULL chat[1277]: timeout set to 6 seconds
Oct 18 22:09:35 NULL chat[1277]: send (ATQ0^M)
Oct 18 22:09:35 NULL chat[1277]: expect (OK)
Oct 18 22:09:35 NULL chat[1277]: ATQ0^M^M
Oct 18 22:09:35 NULL chat[1277]: OK
Oct 18 22:09:35 NULL chat[1277]: -- got it
Oct 18 22:09:35 NULL chat[1277]: send (ATZ^M)
Oct 18 22:09:35 NULL chat[1277]: timeout set to 3 seconds
Oct 18 22:09:35 NULL chat[1277]: expect (OK)
Oct 18 22:09:35 NULL chat[1277]: ^M
Oct 18 22:09:35 NULL chat[1277]: ATZ^M^M
Oct 18 22:09:35 NULL chat[1277]: OK
Oct 18 22:09:35 NULL chat[1277]: -- got it
Oct 18 22:09:35 NULL chat[1277]: send (AT+CPIN=5503^M)
Oct 18 22:09:35 NULL chat[1277]: expect (OKd)
Oct 18 22:09:35 NULL chat[1277]: ^M
Oct 18 22:09:35 NULL chat[1277]: AT+CPIN=5503^M^M
Oct 18 22:09:35 NULL chat[1277]: ERROR^M
Oct 18 22:09:38 NULL chat[1277]: alarm
Oct 18 22:09:38 NULL chat[1277]: send (AT^M)
Oct 18 22:09:38 NULL chat[1277]: expect (OK)
Oct 18 22:09:38 NULL chat[1277]: AT^M^M
Oct 18 22:09:38 NULL chat[1277]: OK
Oct 18 22:09:38 NULL chat[1277]: -- got it
Oct 18 22:09:38 NULL chat[1277]: send (ATI^M)
Oct 18 22:09:38 NULL chat[1277]: expect (OK)
Oct 18 22:09:38 NULL chat[1277]: ^M
Oct 18 22:09:38 NULL chat[1277]: ATI^M^M
Oct 18 22:09:38 NULL chat[1277]: SIM900 R11.0^M
Oct 18 22:09:38 NULL chat[1277]: ^M
Oct 18 22:09:38 NULL chat[1277]: OK
Oct 18 22:09:38 NULL chat[1277]: -- got it
Oct 18 22:09:38 NULL chat[1277]: send (ATZ^M)
Oct 18 22:09:38 NULL chat[1277]: expect (OK)
Oct 18 22:09:38 NULL chat[1277]: ^M
Oct 18 22:09:38 NULL chat[1277]: ATZ^M^M
Oct 18 22:09:38 NULL chat[1277]: OK
Oct 18 22:09:38 NULL chat[1277]: -- got it
Oct 18 22:09:38 NULL chat[1277]: send (ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0^M)
Oct 18 22:09:39 NULL chat[1277]: expect (OK)
Oct 18 22:09:39 NULL chat[1277]: ^M
Oct 18 22:09:39 NULL chat[1277]: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0^M^M
Oct 18 22:09:39 NULL chat[1277]: OK
Oct 18 22:09:39 NULL chat[1277]: -- got it
Oct 18 22:09:39 NULL chat[1277]: send (AT^M)
Oct 18 22:09:39 NULL chat[1277]: expect (OK)
Oct 18 22:09:39 NULL chat[1277]: ^M
Oct 18 22:09:39 NULL chat[1277]: AT^M^M
Oct 18 22:09:39 NULL chat[1277]: OK
Oct 18 22:09:39 NULL chat[1277]: -- got it
Oct 18 22:09:39 NULL chat[1277]: send (AT+CGDCONT=1,"IP","lowi.private.omv.es"^M)
Oct 18 22:09:39 NULL chat[1277]: expect (OK)
Oct 18 22:09:39 NULL chat[1277]: ^M
Oct 18 22:09:39 NULL chat[1277]: AT+CGDCONT=1,"IP","lowi.private.omv.es"^M^M
Oct 18 22:09:39 NULL chat[1277]: OK
Oct 18 22:09:39 NULL chat[1277]: -- got it
Oct 18 22:09:39 NULL chat[1277]: send (ATDT*99***1#^M)
Oct 18 22:09:39 NULL chat[1277]: timeout set to 30 seconds
Oct 18 22:09:39 NULL chat[1277]: expect (CONNECT)
Oct 18 22:09:39 NULL chat[1277]: ^M
Oct 18 22:09:39 NULL chat[1277]: ATDT*99***1#^M^M
Oct 18 22:09:39 NULL chat[1277]: CONNECT
Oct 18 22:09:39 NULL chat[1277]: -- got it
Oct 18 22:09:39 NULL chat[1277]: send (^M)
Oct 18 22:09:39 NULL pppd[1270]: Script /usr/sbin/chat -v -t15 -f /etc/ppp/chatscripts/mobile-modem.chat finished (pid 1276), status = 0x0
Oct 18 22:09:39 NULL pppd[1270]: Serial connection established.
Oct 18 22:09:39 NULL pppd[1270]: using channel 1
Oct 18 22:09:39 NULL pppd[1270]: Using interface ppp0
Oct 18 22:09:39 NULL pppd[1270]: Connect: ppp0 <--> /dev/ttyS0
Oct 18 22:09:40 NULL pppd[1270]: sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic0x16c75854> <pcomp> <accomp>]
Oct 18 22:09:41 NULL pppd[1270]: rcvd [LCP ConfReq id=0x1 <asyncmap 0xa0000> <auth pap>]
Oct 18 22:09:41 NULL pppd[1270]: sent [LCP ConfAck id=0x1 <asyncmap 0xa0000> <auth pap>]
Oct 18 22:09:41 NULL pppd[1270]: rcvd [LCP ConfRej id=0x1 <magic 0x16c75854> <pcomp> <accomp>]
Oct 18 22:09:41 NULL pppd[1270]: sent [LCP ConfReq id=0x2 <asyncmap 0x0>]
Oct 18 22:09:41 NULL pppd[1270]: rcvd [LCP ConfAck id=0x2 <asyncmap 0x0>]
Oct 18 22:09:41 NULL pppd[1270]: sent [LCP EchoReq id=0x0 magic=0x0]
Oct 18 22:09:41 NULL pppd[1270]: sent [PAP AuthReq id=0x1 user="NULL" password=<hidden>]
Oct 18 22:09:41 NULL pppd[1270]: rcvd [LCP EchoRep id=0x0 magic=0x0]
Oct 18 22:09:41 NULL pppd[1270]: rcvd [PAP AuthAck id=0x1 "Login OK"]
Oct 18 22:09:41 NULL pppd[1270]: Remote message: Login OK
Oct 18 22:09:41 NULL pppd[1270]: PAP authentication succeeded
Oct 18 22:09:41 NULL pppd[1270]: sent [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15> <bsd v1 15>]
Oct 18 22:09:41 NULL pppd[1270]: sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
Oct 18 22:09:41 NULL pppd[1270]: rcvd [LCP ProtRej id=0x2 80 fd 01 01 00 0f 1a 04 78 00 18 04 78 00 15 03 2f]
Oct 18 22:09:41 NULL pppd[1270]: Protocol-Reject for 'Compression Control Protocol' (0x80fd) received
Oct 18 22:09:44 NULL pppd[1270]: sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
Oct 18 22:09:44 NULL pppd[1270]: rcvd [IPCP ConfReq id=0x1 <addr 192.200.1.21>]
Oct 18 22:09:44 NULL pppd[1270]: sent [IPCP ConfAck id=0x1 <addr 192.200.1.21>]
Oct 18 22:09:44 NULL pppd[1270]: rcvd [IPCP ConfNak id=0x1 <addr 10.242.68.43> <ms-dns1 195.219.66.42> <ms-dns2 87.119.194.34>]
Oct 18 22:09:44 NULL pppd[1270]: sent [IPCP ConfReq id=0x2 <addr 10.242.68.43> <ms-dns1 195.219.66.42> <ms-dns2 87.119.194.34>]
Oct 18 22:09:44 NULL pppd[1270]: rcvd [IPCP ConfAck id=0x2 <addr 10.242.68.43> <ms-dns1 195.219.66.42> <ms-dns2 87.119.194.34>]
Oct 18 22:09:44 NULL pppd[1270]: not replacing default route to wlan0 [192.168.1.1]
Oct 18 22:09:44 NULL pppd[1270]: local IP address 10.242.68.43
Oct 18 22:09:44 NULL pppd[1270]: remote IP address 192.200.1.21
Oct 18 22:09:44 NULL pppd[1270]: primary DNS address 195.219.66.42
Oct 18 22:09:44 NULL pppd[1270]: secondary DNS address 87.119.194.34
Oct 18 22:09:44 NULL pppd[1270]: Script /etc/ppp/ip-up started (pid 1286)
Oct 18 22:09:44 NULL pppd[1270]: Script /etc/ppp/ip-up finished (pid 1286), status = 0x0
ifconfig 출력:
pi@NULL:~ $ ifconfig
eth0 Link encap:Ethernet HWaddr b8:27:eb:34:7a:5e
inet6 addr: fe80::e8a7:c560:2f66:73a2/64 Scope:Link
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
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:200 errors:0 dropped:0 overruns:0 frame:0
TX packets:200 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:16656 (16.2 KiB) TX bytes:16656 (16.2 KiB)
ppp0 Link encap:Point-to-Point Protocol
inet addr:10.242.68.43 P-t-P:192.200.1.21 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:3 errors:0 dropped:0 overruns:0 frame:0
TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:54 (54.0 B) TX bytes:91 (91.0 B)
wlan0 Link encap:Ethernet HWaddr b8:27:eb:61:2f:0b
inet addr:192.168.1.5 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::509e:723a:2fb:453/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:7937 errors:0 dropped:759 overruns:0 frame:0
TX packets:1040 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1477582 (1.4 MiB) TX bytes:199477 (194.8 KiB)
PD: 호스트 이름을 "NULL"로 설정했는데 로그의 일부 지점에서 혼란을 야기할 수 있습니다. 죄송합니다.