Difficulties to establish a ppp connection to a GSM provider

6,812

Solution 1

Drop the "defaultroute" line and it should work.

You can set the route manually if you have to, but you probably don't have to. It looks like you have a script hooked already that sets he routes when a new interface comes up and it's clobbering pppd.

Solution 2

Something is misconfigured with your pppd setup. If things are working correctly you should see messages from pppd in your logs similar to this:

Oct  5 12:37:35 localhost pppd[1289]: Serial connection established.
Oct  5 12:37:35 localhost pppd[1289]: Using interface ppp0
Oct  5 12:37:35 localhost pppd[1289]: Connect: ppp0 <--> /dev/ttyS1
Oct  5 12:37:36 localhost pppd[1289]: Remote message: Welcome!
Oct  5 12:37:36 localhost pppd[1289]: PAP authentication succeeded
Oct  5 12:37:40 localhost pppd[1289]: local  IP address 109.112.53.134
Oct  5 12:37:40 localhost pppd[1289]: remote IP address 109.112.235.129
Oct  5 12:37:40 localhost pppd[1289]: primary   DNS address 83.224.66.134
Oct  5 12:37:40 localhost pppd[1289]: secondary DNS address 83.224.65.134

References

Share:
6,812

Related videos on Youtube

stdcerr
Author by

stdcerr

Coding mostly on embedded systems (24/7/365 uptime) to make a living at daytime, coding on a variety of systems (x86, arm) for fun at nighttime, preferences: Linux, C &amp; C++. Always interested in learning other ways/better ways to solve problems!

Updated on September 18, 2022

Comments

  • stdcerr
    stdcerr almost 2 years

    I want to establish a ppp link to a GSM provider with my cell phone modem. The modem gets recognized and I can send AT commands just fine, but I can not get the connection established.

    My chat script looks like:

    #######################################
    SAY 'Setting the abort string\n'
    SAY '\n'
    # Abort String ------------------------------
    ABORT 'NO DIAL TONE' ABORT 'NO ANSWER' ABORT 'NO CARRIER' ABORT DELAYED
    
    #######################################
    SAY 'Initializing modem\n'
    # Modem Initialization
    '' AT
    OK ATZ
    
    #######################################
    SAY '\n'
    SAY     'Setting APN\n'
    # Access Point Name (APN)
    # Incorrect APN or CGDCONT can often cause errors in connection.
    # Below are a bunch of different popular APNs
    
    #REG:\s1 AT+cgdcont=1,"IP","proxy"
    #OK     'AT+CGDCONT=0,"IP","proxy"'
    #OK     'AT+CGDCONT=1,"IP","proxy"'
    #OK     'AT+CGDCONT=2,"IP","proxy"'
    OK     'AT+CGDCONT=1,"IP","m2mstatic.apn"'
    #OK     'AT+CGDCONT=1,"IP","ISP.TELUS.COM"'
    #OK     'AT+CGDCONT=1,"IP","INTERNET.COM"'
    #OK     'AT+CGDCONT=1,"IP","ISP.CINGULAR"'
    #OK     'AT+CGDCONT=2,"IP","ISP.CINGULAR"'
       ""
    

    And in /var/log/messages I get the following messages:

    Jan 11 04:08:49 ariag25 pppd[2518]: pppd 2.4.5 started by root, uid 0
    Jan 11 04:08:50 ariag25 chat[2520]: abort on (NO DIAL TONE)
    Jan 11 04:08:50 ariag25 chat[2520]: abort on (NO ANSWER)
    Jan 11 04:08:50 ariag25 chat[2520]: abort on (NO CARRIER)
    Jan 11 04:08:50 ariag25 chat[2520]: abort on (DELAYED)
    Jan 11 04:08:50 ariag25 chat[2520]: send (AT^M)
    Jan 11 04:08:50 ariag25 chat[2520]: expect (OK)
    Jan 11 04:08:50 ariag25 chat[2520]: AT^M^M
    Jan 11 04:08:50 ariag25 chat[2520]: OK
    Jan 11 04:08:50 ariag25 chat[2520]:  -- got it
    Jan 11 04:08:50 ariag25 chat[2520]: send (ATZ^M)
    Jan 11 04:08:51 ariag25 chat[2520]: expect (OK)
    Jan 11 04:08:51 ariag25 chat[2520]: ^M
    Jan 11 04:08:51 ariag25 chat[2520]: ATZ^M^M
    Jan 11 04:08:51 ariag25 chat[2520]: OK
    Jan 11 04:08:51 ariag25 chat[2520]:  -- got it
    Jan 11 04:08:51 ariag25 chat[2520]: send (AT+CGDCONT=1,"IP","m2mstatic.apn"^M)
    Jan 11 04:08:51 ariag25 chat[2520]: expect (OK)
    Jan 11 04:08:51 ariag25 chat[2520]: ^M
    Jan 11 04:08:51 ariag25 chat[2520]: AT+CGDCONT=1,"IP","m2mstatic.apn"^M^M
    Jan 11 04:08:51 ariag25 chat[2520]: OK
    Jan 11 04:08:51 ariag25 chat[2520]:  -- got it
    Jan 11 04:08:51 ariag25 chat[2520]: send (ATDT*99#^M)
    Jan 11 04:08:51 ariag25 chat[2520]: expect (CONNECT)
    Jan 11 04:08:51 ariag25 chat[2520]: ^M
    Jan 11 04:08:51 ariag25 chat[2520]: ATDT*99#^M^M
    Jan 11 04:08:51 ariag25 chat[2520]: CONNECT
    Jan 11 04:08:51 ariag25 chat[2520]:  -- got it
    Jan 11 04:08:51 ariag25 chat[2520]: send (^M)
    Jan 11 04:08:51 ariag25 pppd[2518]: Serial connection established.
    

    Edit

    I don't think things are wrong with my chat script but my modem instead. Notice that on the bottom of the messages, the context switched from chat to pppd - why is that? May my power supply be too weak? That's what I suspect now. Any ideas?

    Also, if I do a killall pppd after this and try to connect with screen

    screen /dev/modem 9600
    

    the modem doesn't reply anymore until I power cycle it.

    However, I'm surprised! I hooked it up to a 2.1A USB power supply.

    Edit2

    My /etc/ppp/options looks like:

    debug
    /dev/ttyUSB1
    9600
    modem
    crtscts
    lock
    connect /etc/ppp/net-connect
    asyncmap 0
    defaultroute
    

    and /etc/ppp/peers/provider like this:

    connect "/usr/sbin/chat -v -f /etc/chatscripts/pap -T *99***1#"
    
    # Serial device to which the modem is connected.
    /dev/modem
    
    # Speed of the serial line.
    9600
    
    # Assumes that your IP address is allocated dynamically by the ISP.
    noipdefault
    # Try to get the name server addresses from the ISP.
    usepeerdns
    # Use this connection as the default route.
    defaultroute
    
    # Makes pppd "dial again" when the connection is lost.
    persist
    
    # Do not ask the remote to authenticate.
    noauth
    
    • Admin
      Admin over 10 years
      Stuck with the same kind of problem. In my case, pppd doesn't establish the network interface. Try dhclient ppp0.
    • Admin
      Admin over 10 years
      What is your pppd configuration?
    • Admin
      Admin over 10 years
      I don't think that's an issue with pppd showing up in your logs. Rather chat has done its job and is handing off control to pppd to get an IP address. I'd look to your pppd setup. It's probably getting hung up, and needs to be configured so that it can get an IP and set up your network connection properly.
    • Admin
      Admin over 10 years
      This guide might be of some help in working through your pppd issues: linuxjournal.com/article/2109
    • Admin
      Admin over 10 years
      @yegorich please see my ppp config above under edit2
  • stdcerr
    stdcerr over 10 years
    Well, I don't, see edit 2 for my ppp config above