Quozl's Open Source

IP over serial on Raspberry Pi

Electronics
How to set up IP over 3.3V serial between a Raspberry Pi and a host computer running Linux.

Prepare the host computer;

  • install the ppp package
    sudo apt install --yes ppp
  • attach a USB to 3.3V serial adapter to the appropriate GPIO pins, and plug it in to the computer,
  • identify the device, let's assume it appears as /dev/ttyUSB0,
  • run as root
    pppd nodetach debug noauth nocrtscts local passive /dev/ttyUSB0 115200 lcp-max-configure 10000

    (this will repeatedly try to establish a connection, because the LCP configure-request transmission count is set very high).
Prepare the Raspberry Pi;

  • install the ppp package
    sudo apt install --yes ppp
  • add two lines to /etc/rc.local before the exit
    systemctl stop serial-getty@ttyAMA0.service
    pppd updetach debug nocrtscts noauth local 10.1.0.1:10.1.0.2 /dev/ttyAMA0 115200
  • reboot
The link will be established, and you can ping or SSH to 10.1.0.1.

Use different addresses if required.

What it looks like on the host computer

using channel 9
Using interface ppp0
Connect: ppp0 <--> /dev/ttyUSB0
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x25b9b80a> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x25b9b80a> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x25b9b80a> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x25b9b80a> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x25b9b80a> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x25b9b80a> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x25b9b80a> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x25b9b80a> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x25b9b80a> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x25b9b80a> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x25b9b80a> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x25b9b80a> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x25b9b80a> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x25b9b80a> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x25b9b80a> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x25b9b80a> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xa67760f> <pcomp> <accomp>]
sent [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0xa67760f> <pcomp> <accomp>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x25b9b80a> <pcomp> <accomp>]
sent [LCP EchoReq id=0x0 magic=0x25b9b80a]
sent [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15> <bsd v1 15>]
sent [IPCP ConfReq id=0x1 <compress VJ 0f 01> <addr 0.0.0.0>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x25b9b80a> <pcomp> <accomp>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x25b9b80a> <pcomp> <accomp>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x25b9b80a> <pcomp> <accomp>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x25b9b80a> <pcomp> <accomp>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x25b9b80a> <pcomp> <accomp>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x25b9b80a> <pcomp> <accomp>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x25b9b80a> <pcomp> <accomp>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x25b9b80a> <pcomp> <accomp>]
rcvd [LCP EchoReq id=0x0 magic=0xa67760f]
sent [LCP EchoRep id=0x0 magic=0x25b9b80a]
rcvd [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15> <bsd v1 15>]
sent [CCP ConfAck id=0x1 <deflate 15> <deflate(old#) 15> <bsd v1 15>]
rcvd [IPCP ConfReq id=0x1 <compress VJ 0f 01> <addr 10.1.0.1>]
sent [IPCP ConfAck id=0x1 <compress VJ 0f 01> <addr 10.1.0.1>]
rcvd [LCP EchoRep id=0x0 magic=0xa67760f]
rcvd [CCP ConfAck id=0x1 <deflate 15> <deflate(old#) 15> <bsd v1 15>]
Deflate (15) compression enabled
rcvd [IPCP ConfNak id=0x1 <addr 10.1.0.2>]
sent [IPCP ConfReq id=0x2 <compress VJ 0f 01> <addr 10.1.0.2>]
rcvd [IPCP ConfAck id=0x2 <compress VJ 0f 01> <addr 10.1.0.2>]
local  IP address 10.1.0.2
remote IP address 10.1.0.1
Script /etc/ppp/ip-up started (pid 80399)
Script /etc/ppp/ip-up finished (pid 80399), status = 0x0
  
(25 September 2022)


quozl@us.netrek.org