Add web GUI, docs, scripts, and 5G router config
- Web app (Flask): status, config, firewall, logs, users, restart - Docs: AT commands, deploy, DNS, quickstart, web GUI - Scripts: connect, deploy, diag, healthcheck, modem-status, speedtest, status, troubleshoot - Init and iptables: 5g-router, 5g-webgui, rules.v4 - CHANGELOG, TODO, REVISION; config and README updates
This commit is contained in:
27
etc/5g-router.conf.example
Normal file
27
etc/5g-router.conf.example
Normal file
@@ -0,0 +1,27 @@
|
||||
# Alpine 5G Router – configuration example
|
||||
# Copy to /etc/5g-router.conf and edit. Used by connect-5g.sh and configure_fm350_5g.sh
|
||||
|
||||
# Modem
|
||||
AT_PORT="/dev/ttyUSB1"
|
||||
APN="internet"
|
||||
|
||||
# Interfaces (WAN = 5G modem RNDIS, LAN = VLAN for clients)
|
||||
WAN_IF="eth1"
|
||||
LAN_IF="eth0.100"
|
||||
|
||||
# Optional: fallback to eth0 when 5G is down (use ethernet as default route)
|
||||
FAILOVER_ENABLED="no"
|
||||
FAILOVER_IF="eth0"
|
||||
FAILOVER_METRIC="202"
|
||||
|
||||
# Watchdog: re-check 5G connectivity every N seconds (0 = disabled, run once)
|
||||
WATCHDOG_INTERVAL="0"
|
||||
|
||||
# Log signal strength to /var/log/5g-router.log (yes/no)
|
||||
LOG_SIGNAL="yes"
|
||||
|
||||
# Alert when signal CSQ below this (0 = disabled)
|
||||
WEAK_SIGNAL_CSQ="10"
|
||||
|
||||
# Optional: DNS servers (used when 5G is up; comma-separated)
|
||||
# DNS_SERVERS="195.14.130.220,195.14.154.100"
|
||||
45
etc/init.d/5g-router
Normal file
45
etc/init.d/5g-router
Normal file
@@ -0,0 +1,45 @@
|
||||
#!/sbin/openrc-run
|
||||
# Alpine 5G Router – OpenRC service
|
||||
# Start: run connect-5g.sh. Stop: bring down WAN interface (optional).
|
||||
# Rev: 5 (see REVISION in repo root)
|
||||
|
||||
description="5G modem connection (connect-5g.sh)"
|
||||
command="/usr/local/bin/connect-5g.sh"
|
||||
command_background="yes"
|
||||
output_log="/var/log/5g-router.log"
|
||||
error_log="/var/log/5g-router.log"
|
||||
pidfile="/run/5g-router.pid"
|
||||
# connect-5g.sh runs run_once then sleep infinity so the process stays up; stop with service 5g-router stop
|
||||
|
||||
# Load config for WAN_IF if we need to clean up on stop
|
||||
[ -f /etc/5g-router.conf ] && . /etc/5g-router.conf
|
||||
WAN_IF="${WAN_IF:-eth1}"
|
||||
|
||||
depend() {
|
||||
need net
|
||||
after bootmisc
|
||||
}
|
||||
|
||||
# Idempotent start: if already running, succeed instead of "already running" error
|
||||
start() {
|
||||
if [ -f "$pidfile" ] && kill -0 "$(cat "$pidfile")" 2>/dev/null; then
|
||||
ebegin "Starting 5g-router"
|
||||
eend 0 "Already running"
|
||||
return 0
|
||||
fi
|
||||
ebegin "Starting 5g-router"
|
||||
start-stop-daemon --start --background --pidfile "$pidfile" --make-pidfile \
|
||||
--stdout "$output_log" --stderr "$error_log" \
|
||||
--exec "$command"
|
||||
eend $?
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
return 0
|
||||
}
|
||||
|
||||
stop_post() {
|
||||
# Optionally bring down 5G interface so traffic uses other default route
|
||||
ip link set "$WAN_IF" down 2>/dev/null || true
|
||||
return 0
|
||||
}
|
||||
27
etc/init.d/5g-webgui
Normal file
27
etc/init.d/5g-webgui
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/sbin/openrc-run
|
||||
# Alpine 5G Router – Web GUI (Flask). Login: admin/support with different permissions.
|
||||
# Rev: 1 (see REVISION in repo root)
|
||||
|
||||
description="5G Router Web GUI (port 5000)"
|
||||
command="/usr/local/share/5g-webgui/run.sh"
|
||||
command_background="yes"
|
||||
pidfile="/run/5g-webgui.pid"
|
||||
output_log="/var/log/5g-webgui.log"
|
||||
error_log="/var/log/5g-webgui.log"
|
||||
|
||||
depend() {
|
||||
need net
|
||||
after bootmisc
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
if [ ! -f /usr/local/share/5g-webgui/app.py ]; then
|
||||
eend 1 "Web GUI not installed at /usr/local/share/5g-webgui"
|
||||
return 1
|
||||
fi
|
||||
if ! command -v python3 >/dev/null 2>&1; then
|
||||
eend 1 "python3 not found. Install: apk add python3 py3-flask"
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
24
etc/iptables/rules.v4
Normal file
24
etc/iptables/rules.v4
Normal file
@@ -0,0 +1,24 @@
|
||||
# Alpine 5G Router – iptables rules (IPv4)
|
||||
# Restored at boot by iptables-restore service. Generated/updated by connect-5g.sh or install.
|
||||
# Ensure 5G WAN interface is eth1 and LAN is eth0.100; adjust if different.
|
||||
|
||||
*filter
|
||||
:INPUT ACCEPT [0:0]
|
||||
:FORWARD ACCEPT [0:0]
|
||||
:OUTPUT ACCEPT [0:0]
|
||||
# Allow web GUI (port 5000) from eth0 (management access)
|
||||
-A INPUT -i eth0 -p tcp --dport 5000 -j ACCEPT
|
||||
# Allow LAN -> WAN (5G)
|
||||
-A FORWARD -i eth0.100 -o eth1 -j ACCEPT
|
||||
# Allow established/related WAN -> LAN
|
||||
-A FORWARD -i eth1 -o eth0.100 -m state --state RELATED,ESTABLISHED -j ACCEPT
|
||||
COMMIT
|
||||
|
||||
*nat
|
||||
:PREROUTING ACCEPT [0:0]
|
||||
:INPUT ACCEPT [0:0]
|
||||
:OUTPUT ACCEPT [0:0]
|
||||
:POSTROUTING ACCEPT [0:0]
|
||||
# NAT LAN traffic going out 5G
|
||||
-A POSTROUTING -o eth1 -j MASQUERADE
|
||||
COMMIT
|
||||
Reference in New Issue
Block a user