[Freedombox-discuss] How to automate ppp?

A. F. Cano afc at shibaya.lonestar.org
Sun Jul 17 02:48:49 UTC 2016


I'm currently starting ppp manually.  I have to run "sudo pon cell" from ssh
and this usually requires entering the sudo password.  Unfortunately, I get
disconnected with "LCP terminated by peer" at random times and each time I
have to restart manually.  Of course each time I get a different IP address
but that should be taken care of by the dynamic dns client.  This means that
it has to be done outside of ppp, the ppp option -persist is not enough since
I need to know the ip address beforehand.

When I first connect the phone to the usb port, it is detected and I get this:


Jun 20 21:13:24 fbx kernel: [863159.027920] usb 4-1: new full-speed USB device number 12 using ohci-pci
Jun 20 21:13:24 fbx kernel: [863159.195083] usb 4-1: New USB device found, idVendor=22b8, idProduct=2a62
Jun 20 21:13:24 fbx kernel: [863159.195100] usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Jun 20 21:13:24 fbx kernel: [863159.195109] usb 4-1: Product: Motorola E815
Jun 20 21:13:24 fbx kernel: [863159.195117] usb 4-1: Manufacturer: Motorola, Inc.
Jun 20 21:13:24 fbx kernel: [863159.199280] cdc_acm 4-1:1.0: ttyACM0: USB ACM device
Jun 20 21:13:37 fbx NetworkManager[488]: <info>  [1466471617.7751] manager: (ttyACM0): new Broadband device (/org/freedesktop/NetworkManager/Devices/55)
Jun 20 21:13:37 fbx NetworkManager[488]: <info>  [1466471617.7777] device (ttyACM0): state change: unmanaged -> unavailable (reason 'managed') [10 20 2]
Jun 20 21:13:37 fbx NetworkManager[488]: <info>  [1466471617.7802] device (ttyACM0): modem state 'enabling'
Jun 20 21:13:37 fbx NetworkManager[488]: <warn>  [1466471617.7829] (ttyACM0): failed to retrieve SIM object: No SIM object available
Jun 20 21:13:37 fbx NetworkManager[488]: <info>  [1466471617.7858] device (ttyACM0): state change: unavailable -> disconnected (reason 'none') [20 30 0]


but I'm missing something.  Obviously the network manager doesn't know that
it has to run "pon cell" (cell is a file created by me to actually make the
proper ppp call - it's actually in /etc/ppp/peers).

Where (in what config file) should I tell network manager to do this so it's
done automatically?

When I type "sudo pon cell" via ssh the first time after connecting the
phone it always fails.  This is a problem with the phone obviously, so I
have to retype "sudo pon cell" and the second time it's quick and automatic.


Jun 20 21:13:50 fbx pppd[10666]: pppd 2.4.7 started by ac-adm, uid 0
Jun 20 21:13:51 fbx chat[10668]: abort on (BUSY)
Jun 20 21:13:51 fbx chat[10668]: abort on (NO CARRIER)
Jun 20 21:13:51 fbx chat[10668]: abort on (VOICE)
Jun 20 21:13:51 fbx chat[10668]: abort on (NO DIALTONE)
Jun 20 21:13:51 fbx chat[10668]: abort on (NO DIAL TONE)
Jun 20 21:13:51 fbx chat[10668]: abort on (NO ANSWER)
Jun 20 21:13:51 fbx chat[10668]: abort on (DELAYED)
Jun 20 21:13:51 fbx chat[10668]: send (ATZ^M)
Jun 20 21:13:51 fbx chat[10668]: expect (OK)
Jun 20 21:13:51 fbx chat[10668]: ^M
Jun 20 21:14:08 fbx chat[10668]: AT+CA?^MAT+CSQ^M^M
Jun 20 21:14:36 fbx chat[10668]: alarm
Jun 20 21:14:36 fbx chat[10668]: send (AT^M)
Jun 20 21:14:36 fbx chat[10668]: expect (OK)
Jun 20 21:14:36 fbx chat[10668]: ^M^M
Jun 20 21:14:37 fbx chat[10668]: AT+CAD?^M^M
Jun 20 21:14:37 fbx chat[10668]: AT+CSS?^M^M
Jun 20 21:14:38 fbx chat[10668]: AT+CSQ^M^M
Jun 20 21:15:07 fbx chat[10668]: AT+CAD?^M^M
Jun 20 21:15:08 fbx chat[10668]: AT+CSQ^M^M
Jun 20 21:15:21 fbx chat[10668]: alarm
Jun 20 21:15:21 fbx chat[10668]: Failed
Jun 20 21:15:22 fbx pppd[10666]: Exit.


Here I have to re-type "sudo pon cell" but since I just typed the same a
couple of minutes ago, I don't have to retype the sudo password.


Jun 20 21:15:56 fbx pppd[10673]: pppd 2.4.7 started by ac-adm, uid 0
Jun 20 21:15:57 fbx chat[10675]: abort on (BUSY)
Jun 20 21:15:57 fbx chat[10675]: abort on (NO CARRIER)
Jun 20 21:15:57 fbx chat[10675]: abort on (VOICE)
Jun 20 21:15:57 fbx chat[10675]: abort on (NO DIALTONE)
Jun 20 21:15:57 fbx chat[10675]: abort on (NO DIAL TONE)
Jun 20 21:15:57 fbx chat[10675]: abort on (NO ANSWER)
Jun 20 21:15:57 fbx chat[10675]: abort on (DELAYED)
Jun 20 21:15:57 fbx chat[10675]: send (ATZ^M)
Jun 20 21:15:57 fbx chat[10675]: expect (OK)
Jun 20 21:15:57 fbx chat[10675]: ATZ^M^M
Jun 20 21:15:57 fbx chat[10675]: OK
Jun 20 21:15:57 fbx chat[10675]:  -- got it
Jun 20 21:15:57 fbx chat[10675]: send (ATDT#777^M)
Jun 20 21:15:57 fbx chat[10675]: timeout set to 60 seconds
Jun 20 21:15:57 fbx chat[10675]: expect (CONNECT)
Jun 20 21:15:57 fbx chat[10675]: ^M
Jun 20 21:16:06 fbx chat[10675]: ATDT#777^M^M
Jun 20 21:16:06 fbx chat[10675]: CONNECT
Jun 20 21:16:06 fbx chat[10675]:  -- got it
Jun 20 21:16:06 fbx chat[10675]: send (\d)
Jun 20 21:16:07 fbx pppd[10673]: Serial connection established.
Jun 20 21:16:07 fbx pppd[10673]: Using interface ppp0
Jun 20 21:16:07 fbx pppd[10673]: Connect: ppp0 <--> /dev/ttyACM0

Here the network manager is notified that the connection is up.


Jun 20 21:16:07 fbx NetworkManager[488]: <info>  [1466471767.8926] manager: (ppp0): new Generic device (/org/freedesktop/NetworkManager/Devices/56)
Jun 20 21:16:07 fbx NetworkManager[488]: <info>  [1466471767.9237] devices added (path: /sys/devices/virtual/net/ppp0, iface: ppp0)
Jun 20 21:16:07 fbx NetworkManager[488]: <info>  [1466471767.9238] device added (path: /sys/devices/virtual/net/ppp0, iface: ppp0): no ifupdown configuration found.
Jun 20 21:16:08 fbx pppd[10673]: local  IP address 75.213.71.117
Jun 20 21:16:08 fbx pppd[10673]: remote IP address 66.174.121.80
Jun 20 21:16:08 fbx pppd[10673]: primary   DNS address 198.224.186.135
Jun 20 21:16:08 fbx pppd[10673]: secondary DNS address 198.224.187.135


>From this point on everything works until verizon decides to hang up on me
with "LCP terminated by peer".  Then I have to do the "sudo pon cell" again.
>From then on it works fine the first time until I disconnect the phone from the
usb cable.

When I get disconnected, the network manager knows about it:

Jul 16 21:01:24 fbx NetworkManager[488]: <warn>  [1468717284.7880] device (ppp0): failed to disable userspace IPv6LL address handling
Jul 16 21:01:24 fbx NetworkManager[488]: <info>  [1468717284.8046] devices removed (path: /sys/devices/virtual/net/ppp0, iface: ppp0)

What I would like to have happen when this occurs is to have network manager
run "pon cell" and reconnect.  How can I achieve this? I've never dealt with
network manager before.  Would network manager know to retry after the first
failure? (via a timeout I presume)

It would also be nice if I could automatically disconnect at a certain time
even if the phone is still plugged in.  This would have to be done from
within network manager or it would attempt to restart the connection.  Is it
possible to tell network manager that a connection can only be brought up
within the hours of x and y?  Similar to how uucp does it, maybe?

Any help/hints will be gratefully received.  Obviously I'm a total network
manager newbie.  Thank you for reading this far.

Augustine




More information about the Freedombox-discuss mailing list