edit | blame | history | raw

Smart Diaper Gateway OS

OS install to SD CARD

Raspberry Pi Manager

Raspberry Pi OS (other) -> Raspberry Pi OS Lite

option
-> SSH enable
-> wifi country KR
-> locale Asia/Seoul

get gw install script from git server

curl -k -O https://onioi.com:8443/raw/MEDILOGIS/gwinstall.git/master/gwinstall.sh

install SSH tunnel service on RPi4

#!/bin/bash

export FWD_PORT=10000
if [ ! $1 ]; then
    echo -e "USAGE:\nex) gwinstall.sh 10000"
    exit 1
else
    FWD_PORT=$1
fi

sudo ssh-keygen
sudo ssh-copy-id -p 12222 root@onio.iptime.org

echo "
[Unit]
Description=SSH Tunnel with target server
After=network.target

[Service]
ExecStart=/usr/bin/ssh -NT -o ServerAliveInterval=60 -o ExitOnForwardFailure=yes -R 127.0.0.1:$FWD_PORT:localhost:22 -p 12222 root@onio.iptime.org
RestartSec=5
Restart=always

[Install]
WantedBy=multi-user.target
" |  sudo tee /etc/systemd/system/tunnel.service  > /dev/null

sudo systemctl daemon-reload
sudo systemctl start tunnel
sudo systemctl enable tunnel
sudo systemctl status tunnel

Change sshd_config

sudo vi /etc/ssh/sshd_config

AllowTcpForwarding yes
GatewayPorts yes
sudo service ssh restart

Check server side RPi4 SSH tunnel port

netstat -tulpn

Connect to RPi4 via SSH tunnel


ssh -J root@onio.iptime.org:12222 -p 10000 medi@localhost

install packages

sudo apt-get update
sudo apt install -y git nodejs npm bluetooth bluez libbluetooth-dev libudev-dev bluez-hcidump
sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)

RPi 4 USB WiFi tplink archer t2 plus

sudo apt install -y git dkms raspberrypi-kernel-headers build-essential bc

git clone https://github.com/aircrack-ng/rtl8812au.git
cd rtl8812au
sed -i 's/CONFIG_PLATFORM_I386_PC = y/CONFIG_PLATFORM_I386_PC = n/g' Makefile
sed -i 's/CONFIG_PLATFORM_ARM_RPI = n/CONFIG_PLATFORM_ARM_RPI = y/g' Makefile

sudo make dkms_install

kernel header issue ( Error! DKMS tree already contains: 8812au-5.6.4.2_35491.20191025 )
sudo apt-get upgrade sudo reboot sudo apt install build-essential libelf-dev linux-headers-$(uname -r) sudo dkms status sudo dkms remove 8812au/5.6.4.2_35491.20191025 --all sudo dkms status sudo make dkms_install

RPi4 internal WiFi disable & USB WiFi enable wlan0

/boot/config.txt

append

dtoverlay=disable-wifi

and reboot

RPi 4 Korean font install

sudo apt install -y fonts-unfonts-core

RPi 4 measure temp

vcgencmd measure_temp

RPi 4 SD Card wifi setting

Put the wpa_supplicant.conf file with the following contents in /boot folder of the sd card.
When the setting is completed, the x file will be deleted from the /boot folder of the sd card.

country=KR # Your 2-digit country code
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

network={
    ssid="wifi ssid"
    psk="widi passwd"
}

WireGuard

sudo apt install wireguard
sudo vi /etc/wireguard/wg0.conf
sudo vi /etc/network/interfaces.d/wg0
sudo ifup wg0
ip route get 10.8.0.1
ping -c 3 10.8.0.1
sudo wg show wg0

/etc/wireguard/wg0.conf
```
[Interface]
PrivateKey =

Address = 10.8.0.2/24

DNS = 1.1.1.1

MTU = 1420

[Peer]
PublicKey =
PresharedKey =
AllowedIPs = 192.168.1.0/24, 10.8.0.0/24
PersistentKeepalive = 30
Endpoint = vp.onioi.com:51888
```

/etc/network/interfaces.d/wg0
```

indicate that wg0 should be created when the system boots, and on ifup -a

auto wg0

describe wg0 as an IPv4 interface with static address

iface wg0 inet static

    # the IP address of this client on the WireGuard network
    address 10.8.0.2/24

    # before ifup, create the device with this ip link command
    pre-up ip link add $IFACE type wireguard

    # before ifup, set the WireGuard config from earlier
    pre-up wg setconf $IFACE /etc/wireguard/$IFACE.conf

    # after ifdown, destroy the wg0 interface
    post-down ip link del $IFACE


### update gateway ###

curl "https://onioi.com:8443/zip/?r=MEDILOGIS/gwinstall.git&p=dist&h=master&format=gz" -k -o dist.tar.gz
```

TODO

ref

USB WiFi tplink archer t2 plus ( https://github.com/nlkguy/archer-t2u-plus-linux )

README 4 KB