51 lines
1.5 KiB
Markdown
51 lines
1.5 KiB
Markdown
# Packet Forwarder
|
|
|
|
SSH to the Raspberry Pi.
|
|
|
|
Clone the packet forwarder repository: `git clone https://github.com/Lora-net/sx1302_hal.git`.
|
|
|
|
Go into the repo and run `make`.
|
|
|
|
Make pf user + give permissions
|
|
|
|
- `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)
|
|
|
|
From the packet forwarder repo, copy files to pf user's home and set permissions:
|
|
|
|
```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`:
|
|
|
|
```systemd
|
|
[Unit]
|
|
Description=SX1302 Packet Forwarder
|
|
After=network.target
|
|
StartLimitIntervalSec=0
|
|
|
|
[Service]
|
|
Type=simple
|
|
Restart=always
|
|
RestartSec=1
|
|
User=pf
|
|
WorkingDirectory=/home/pf
|
|
ExecStart=/home/pf/lora_pkt_fwd -c global_conf.json.sx1250.US915
|
|
|
|
[Install]
|
|
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`.
|