Setting up PPP Networking

The most versatile arrangement for an RPi900 radio network is to furnish the remotes with a full internet service over the radio link. Having a full TCP/IP connection to your remote Raspberry Pi can make in-situ maintenance and modification much simpler. You can login via SSH to change settings and add functionality, without needing physical access to the remote site. Finally, you can run any network protocols and services you desire–web, SSH, file sharing, even media streaming.

Networking is achieved by establishing a Point-to-Point Protocol (PPP) connection over the radio link. The base then forwards that connection to the local network and thence the internet.

This tutorial describes a situation in which the base Raspberry Pi is connected to a local area network with subnet 10.1.1.0/24 in CIDR notation. (Yours may be different; e.g. 192.168.1.0/24 is also common.) Connection can be via eth0 ethernet or wlan0 wireless. Static IP addresses are used for simplicity; you may need to reserve some static IP address space on your router.

Installing PPP Software

The rpi900-ppp package provides the necessary setup for both base and remote radios. Build and install the package in the same manner as before:

$cd packages/rpi900-ppp
$makepkg --clean
$sudo pacman -U rpi900-ppp-0.1-3-armv6h.pkg.tar.xz

When installing the package you will be reminded about the /etc/rpi900-ppp.conf configuration file. Edit this file to set the local IP address. If the RPi900 is to act as a base station, you should also specify the name of its internet-facing network interface: eth0 for ethernet or wlan0 for wifi.

$su                                                 # must be root to edit /etc/*
#echo IPADDRESS=10.1.1.250 >> /etc/rpi900-ppp.conf  # set the IP address on the local network
#echo PROXY=eth0 >> /etc/rpi900.conf                # set the network interface name (base only)

Finally, configure PPP authentication by adding a password to /etc/ppp/chap-secrets:

#echo "* * sesame 10.1.1.0/24" >> /etc/ppp/chap-secrets

Alternatively, use the authentication abilities of the DNT900 itself and disable PPP authentication:

#echo OPTIONS=noauth >> /etc/rpi900.conf  # disable PPP authentication

Operation

Operation of the PPP service is automatic once the software is installed and the system rebooted. The DeviceMode register of the local radio is interrogated to determine whether the RPi900 is acting as a base station. When a linked radio is detected, a PPP service for that radio is launched automatically. If the RPi900 is a base station, the requisite address proxying and IP forwarding is also enabled.

On your base station, you can observe a successful PPP connection to a remote RPi900 by checking the systemd journal:

$sudo journalctl -b --unit=rpi900-ppp*
Apr 23 08:24:14 roof systemd[1]: Starting PPP link over /dev/ttyDNT1...
Apr 23 08:24:14 roof sysctl[416]: net.ipv4.ip_forward = 1
Apr 23 08:24:15 roof sysctl[422]: net.ipv4.conf.eth0.proxy_arp = 1
Apr 23 08:24:15 roof systemd[1]: Started PPP link over /dev/ttyDNT1.
Apr 23 08:24:15 roof pppd[427]: pppd 2.4.6 started by root, uid 0
Apr 23 08:24:15 roof pppd[427]: Using interface ppp0
Apr 23 08:24:15 roof pppd[427]: Connect: ppp0 <--> /dev/ttyDNT1
Apr 23 08:24:18 roof pppd[427]: EAP: Identity prompt "Name"
Apr 23 08:24:18 roof pppd[427]: EAP: unauthenticated peer name "proto"
Apr 23 08:24:18 roof pppd[427]: EAP authentication succeeded
Apr 23 08:24:19 roof pppd[427]: Deflate (15) compression enabled
Apr 23 08:24:19 roof pppd[427]: found interface eth0 for proxy arp
Apr 23 08:24:19 roof pppd[427]: local  IP address 10.1.1.250
Apr 23 08:24:19 roof pppd[427]: remote IP address 10.1.1.247

Confirm the connection with a ping:

$ping -c 5 10.1.1.247
PING 10.1.1.247 (10.1.1.247) 56(84) bytes of data.
64 bytes from 10.1.1.247: icmp_seq=1 ttl=64 time=24.0 ms
64 bytes from 10.1.1.247: icmp_seq=2 ttl=64 time=21.9 ms
64 bytes from 10.1.1.247: icmp_seq=3 ttl=64 time=20.2 ms
64 bytes from 10.1.1.247: icmp_seq=4 ttl=64 time=17.7 ms
64 bytes from 10.1.1.247: icmp_seq=5 ttl=64 time=23.8 ms

You should now be able to log in to the remote RPi900 over the radio link using SSH. Not bad!

If you’re operating multiple remotes, the base RPi900 will launch a separate PPP instance for each of them. It’s possible to selectively allow or deny PPP to specific radios; see the package documentation for more details.

Operation in Transparent Mode

The rpi900-ppp package supports operation on remote radios without using the rpi900 line discipline service installed or in use. This involves operating the radio in transparent mode, with the PPP service attached directly to the ttyAMA0 serial port. With this arrangement the remote RPi900 cannot access its radio’s registers, but this may not be necessary since they can still be accessed via the base RPi900 when linked.

As described in the documentation, you must ensure some DNT900 register values have the correct values for transparent-mode operation on the remote RPi900:

$su
#cd /sys/devices/virtual/dnt900/ttyAMA0/0x00165E/
#echo 0x00 > ProtocolMode          # disable protocol mode
#echo 0x000000 > RmtTransDestAddr  # send transparent-mode data to base radio
#echo 0x01 > ProtocolSequenceEn    # disable 'EnterProtocolMode' sequence
#echo 0x01 > MemorySave            # save settings

(The MinPacketLength and TxTimeout register values may also need adjustment to maximise throughput.) Then, to set up transparent-mode operation for PPP:

#systemctl disable rpi900          # only if the rpi900 service is installed & enabled
#systemctl enable rpi900-ppp
#reboot

The main benefit of transparent-mode operation is a reduced workload on the remote Raspberry Pi, since the DNT900 line discipline is not running. It is also required if you’re running your radios in dynamic TDMA mode, since the DNT900 line discipline does not work well in this mode.

Behind the Scenes

The rpi900-ppp package lets you set up PPP networking on the RPi900 very quickly. Nonetheless, it’s helpful to understand how these services are provided. I recommend a quick look at the contents of the package, in particular the systemd .service files which manage the PPP connection for base and remotes, and the udev .rules file which selectively launches the services when linked radios are detected.

The best place to start learning more about PPP is on the Raspberry Pi itself:

$man pppd