0

I am trying to get internet connection in my raspberry pi 3 (Raspbian) with a GSM (SIM900a) module, connecting it to RXD/TXD Serial ports (/dev/ttyS0), I already got an ip address and DNSs, but I can't even ping any host, so I think it must be a routing problem.

I think that what I am missing may be an iptables rule... something with POSTROUTING MASQUERADE? I don't know...

ppp output in /var/log/messages:

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 output:

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: I've set my hostname to "NULL", which may be confused at some points of the log, I'm sorry

  • PPP seems to work, you have a point-to-point connection. Now you need a default route (ip route or route) that sends all packets over these connection. You can also use a program like wvdial to do these things for you. – dirkt Oct 19 '16 at 6:15
  • Yeah, that's what I though, thanks for confirm it. Do you mean route add default ppp0 maybe? I already tried this, and also tried changing ppp0 with ip and gateway and neither worked :/ I will have a look at wvdial again, thanks! – Mc Kernel Oct 19 '16 at 7:34
  • Something like ip route add default via 10.242.68.43 dev ppp0 or route add default gw 10.242.68.43 dev ppp0 (not tested, with the current ip addr of ppp0 of course). Use ip route or route to verify the route is correct. You may have to delete your old default route, and I don't remember if it works without. – dirkt Oct 19 '16 at 9:18
  • I think that I already tested the second command, even previously deleting the original default route, but probably with a wrong ip... I will try again later when I am at home. Do I need to restart networking service to apply it? to create a iptables rule or something? or should be enough just with that command? Thanks – Mc Kernel Oct 19 '16 at 10:21
  • No restart needed, no iptables rules needed. With a default rule, sending packets to the internet should work (verify with ping/traceroute/mtr). You may still need to sort out your nameserver(s), depending on what you use/what your GSM ISP offers. You can automate setting the default route with options to pppd, or using wvdial etc. – dirkt Oct 19 '16 at 12:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.