diff --git a/doc/1-raspberry-pi-setup.md b/doc/1-raspberry-pi-setup.md index e725506..f8fa6c4 100644 --- a/doc/1-raspberry-pi-setup.md +++ b/doc/1-raspberry-pi-setup.md @@ -4,5 +4,34 @@ Download the [Raspberry Pi Imager](https://flathub.org/apps/org.raspberrypi.rpi- Download Raspberry Pi OS Lite 64-bit from the [Raspberry Pi download page](https://www.raspberrypi.com/software/operating-systems/) -Settings in the imager +Open the imager and do the following: +- Choose custom image (at the bottom) + - Pick the OS file you downloaded +- Choose your SD card for storage +- Click the gear icon for settings + - Set hostname, enable SSH, set username/password, set WiFI as desired +- Click image + +Once writing is done, put the SD card in and start up the Pi. Wait a minute for it to start and join the network. + +Find the IP address of the Pi via your router (look for DHCP leases) and SSH in. + +![Example pfSense DHCP Lease Page](dhcp-leases.png) + +Change the IP address to be static by adding the following to the bottom of `/etc/dhcpcd.conf` (modify for your own environment, using `eth0` for wired): + +```conf +interface wlan0 +static ip_address=192.168.0.181 +static routers=192.168.0.1 +static domain_name_servers=192.168.0.1 +``` + +Enable SPI in the Raspberry Pi config by editing `/boot/config.txt` and uncommenting the line `#dtparam=spi=on`. + +Update, upgrade, and install Git: `sudo apt update && sudo apt -y upgrade && sudo apt install -y git`. + +Reboot and SSH in to the new static IP you assigned. + +The Pi is ready for the packet forwarder to be installed. diff --git a/doc/2-packet-forwarder.md b/doc/2-packet-forwarder.md index 9ac846e..8aedc08 100644 --- a/doc/2-packet-forwarder.md +++ b/doc/2-packet-forwarder.md @@ -1,20 +1,29 @@ # Packet Forwarder -Download `lora_pkt_fwd` from +SSH to the Raspberry Pi. -Run `make` +Clone the packet forwarder repository: `git clone https://github.com/Lora-net/sx1302_hal.git`. -Setup config +Go into the repo and run `make`. Make pf user + give permissions -Copy files to pf user's home: +- `sudo useradd -m -s /usr/sbin/nologin pf` + - `-m`: create home + - `-s /usr/sbin/nologin`: don't allow logging in; the user's only purpose is to own the packet forwarder process + - `pf`: the username +- `sudo usermod -aG gpio pf` (the `spi` group is not sufficient, and it is also not needed when part of the `gpio` group) -- `global_conf.json.sx1250.US915` -- `lora_pkt_fwd` -- `reset_lgw.sh` +From the packet forwarder repo, copy files to pf user's home and set permissions: -(Make sure execute permission is set on `lora_pkt_fwd` and `reset_lgw.sh`.) +```sh +sudo cp packet_forwarder/{global_conf.json.sx1250.US915,lora_pkt_fwd} /home/pf +sudo cp tools/reset_lgw.sh /home/pf +sudo chown pf:pf /home/pf/{global_conf.json.sx1250.US915,lora_pkt_fwd,reset_lgw.sh} +sudo chmod +x /home/pf/{lora_pkt_fwd,reset_lgw.sh} +``` + +Modify the packet forward config at `/home/pf/global_conf.json.sx1250.US915`. Change `gateway_ID` to something nice (????). 8 bytes (16 uppercase hex characters) Create SystemD unit file at `/etc/systemd/system/packet-forwarder.service`: @@ -37,3 +46,5 @@ WantedBy=multi-user.target ``` Start and enable `sudo systemctl enable --now packet-forwarder.service`. + +Check that it is running with `sudo systemctl status packet-forwarder.service`. diff --git a/doc/dhcp-leases.png b/doc/dhcp-leases.png new file mode 100644 index 0000000..530a4c5 Binary files /dev/null and b/doc/dhcp-leases.png differ