[openwrt] start viirb/monitor

This commit is contained in:
Nico Schottelius 2024-08-13 16:43:13 +02:00
commit 98f168c2d2

View file

@ -0,0 +1,77 @@
#!/bin/sh
# Nico Schottelius, 2024-07-22
# This script assumes a clean/newly setup openwrt device
#
# Assumption:
# VIIRB being used to...
# - monitor camera
# - monitor UPS via USB
if [ $# -lt 8 ] ; then
echo $0 "address hostname wifi-ssid wifi-psk"
fi
address=$1; shift
hostname=$1; shift
wifi_ssid=$1; shift
wifi_psk=$1; shift
cat <<EOF | ssh -t "root@${address}"
set -x
opkg update
# add jool + bird2 + tcpdump
# opkg install jool-tools-netfilter bird2 bird2c tcpdump tmux atop nload
# Do not announce ULA - we have GUA
uci delete network.globals.ula_prefix
# Remove IPv6 assign, we are using static IPv6
uci delete network.lan.ip6assign
# Disable firewalling effectively to allow traffic any direction
# uci set firewall.@defaults[0].input=ACCEPT
# uci set firewall.@defaults[0].forward=ACCEPT
# Set hostname
uci set system.@system[0].hostname="${hostname}"
# Make LAN IPv6 dynamic
uci delete network.lan.ipaddr
uci delete network.lan.netmask
uci delete network.lan.gateway
uci set network.lan.proto="dhcpv6"
# Need to remove ipv6 source based routing - leads to route not working
uci set network.lan.sourcefilter=0
# Disable DHCP on LAN
uci delete dhcp.lan.dhcpv4
uci delete dhcp.lan.dhcpv6
uci delete dhcp.lan.ra
uci set dhcp.lan.ignore=1
uci set wireless.default_radio0.mode='sta'
uci set wireless.default_radio0.ssid='${wifi_ssid}'
uci set wireless.default_radio0.encryption='psk2'
uci set wireless.default_radio0.key='${wifi_psk}'
uci set wireless.radio0.htmode='HT40'
uci set wireless.radio0.channel='auto'
uci set network.wwan.proto='dhcpv6'
uci set network.wwan.device='phy0-sta0'
uci commit
# TODO: Do something wireless (?), maybe disable?
uci commit
/etc/init.d/bird restart
EOF
echo "Restart router to restart firewall, network, dhcp"