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:
nearxos
2026-02-02 09:38:23 +02:00
parent 1136a332b5
commit 160ad641ce
46 changed files with 4320 additions and 40 deletions

View File

@@ -97,10 +97,13 @@ echo -e 'AT+CFUN=1,1\r' > /dev/ttyUSB1
### Why DHCP Doesn't Work
The RNDIS interface (`eth1`) does **not** provide DHCP. The modem manages the connection internally. You must:
The RNDIS interface (`eth1`) does **not** provide DHCP. The modem does not assign an IP to the host via DHCP. You must:
1. Get the IP from the modem via `AT+CGPADDR=1`
2. Configure the interface manually
1. Get the IP from the modem via **`AT+CGPADDR=1`**
2. Optionally get DNS via **`AT+CGCONTRDP=1`** (connection dynamic parameters)
3. Configure the interface and `/etc/resolv.conf` manually
The **connect-5g.sh** script does exactly this: it uses AT commands only (no DHCP on eth1), then sets `ip addr` and default route on eth1, and DNS from modem or from config.
### Manual Configuration
@@ -169,16 +172,68 @@ ping -c 3 8.8.8.8
## Troubleshooting
### AT Commands Not Responding
### Run full diagnostic (modem not responding after reboot)
**Symptoms:** No response to AT commands on any port.
**When the modem does not respond** after a reboot, run the full troubleshoot script on the device to collect all logs and checks:
```bash
# On the device (SSH or console)
/usr/local/bin/troubleshoot-5g.sh
```
If the script is not installed yet, deploy first (`./scripts/deploy.sh` or `./scripts/install.sh` on the device), or run from the repo:
```bash
./scripts/troubleshoot-5g.sh
```
The script prints:
- **dmesg** (last 40 lines) kernel messages about USB/tty
- **lsusb** modem present and Mode 40 (7126) vs Mode 41 (7127)
- **/dev/ttyUSB*** whether each port is a character device or a broken regular file
- **AT test** on the configured port (with 3s wait, like connect-5g.sh)
- **AT probe** on each ttyUSB port which port returns OK
- **5g-router service** status
- **WAN interface** and default route
- **Last 60 lines** of `/var/log/5g-router.log`
- **modem-status-at.sh** output (registration, signal) if installed
Copy the full output and use it to see: wrong AT port, broken ttyUSB node, modem in Mode 41, or service/APN issues. Then apply the fixes listed at the end of the script or in the sections below.
### AT Commands Not Responding / "AT not OK"
**Symptoms:** No response to AT commands, or connect script logs "AT not OK".
**Solutions:**
1. Check modem is in Mode 40: `lsusb | grep 7126`
2. If in Mode 41 (7127), AT commands won't work - need physical access to switch back
3. Try different ports: ttyUSB0, ttyUSB1, ttyUSB2
1. **Wait longer** The modem can take 24 seconds to respond. The script now waits 3 s for the initial AT. If you still see "AT not OK", increase the wait in `get_at_response` or in config.
2. Check modem is in Mode 40: `lsusb | grep 7126`
3. If in Mode 41 (7127), AT commands won't work - need physical access to switch back
4. **Try different ports** On FM350-GL the AT port is often ttyUSB1, but it can be ttyUSB0 or another. Test manually:
```bash
( timeout 5 cat /dev/ttyUSB1 & ); sleep 0.5; echo -e 'AT\r' > /dev/ttyUSB1; sleep 3; kill %1 2>/dev/null
```
If you see `OK` in the output, that port works. Set `AT_PORT="/dev/ttyUSB1"` (or the working port) in `/etc/5g-router.conf`.
5. Ensure no other process is holding the port (e.g. ModemManager, or a stuck cat). Stop ModemManager if present: `rc-service ModemManager stop`
### ttyUSB3 Shows as Regular File
### ttyUSB port shows as regular file (AT not responding)
**Symptoms:** `ls -la /dev/ttyUSB1` shows `-rw-rw----` (regular file) instead of `crw-rw----` (character device). AT commands get no reply or garbage.
**Cause:** Sometimes after modem disconnect/reconnect (or a script writing to the port when it was missing), a regular file is created at `/dev/ttyUSB1` (or another number). The kernel then attaches the real device to a different name or the file blocks the node.
**Fix (one-time):**
```bash
# Replace N with the port number (0, 1, 2, …)
rm -f /dev/ttyUSB1
mknod /dev/ttyUSB1 c 188 1
chmod 660 /dev/ttyUSB1
chown root:dialout /dev/ttyUSB1
```
**Prevention:** `connect-5g.sh` now checks and fixes a broken AT port automatically before use (recreates the device node if it is a regular file).
### ttyUSB3 Shows as Regular File (legacy)
**Symptoms:** `ls -la /dev/ttyUSB3` shows `-rw-r--r--` instead of `crw-rw----`
@@ -196,11 +251,15 @@ chown root:dialout /dev/ttyUSB3
**Solution:** Don't use `stty`. Send AT commands directly with `echo` and `cat`.
### No IP on eth1
### No IP on eth1 / Could not get modem IP
**Symptoms:** `ip addr show eth1` shows no inet address after DHCP attempt.
**Symptoms:** `ip addr show eth1` shows no inet address; or connect script logs "Could not get modem IP".
**Solution:** RNDIS doesn't use DHCP. Configure IP manually from `AT+CGPADDR=1`.
**Solutions:**
1. RNDIS doesn't use DHCP. The script gets the IP from `AT+CGPADDR=1`; if the operator hasn't assigned one yet, it retries a few times. Wait and re-run the connection script.
2. Check registration and signal: run `AT+CEREG?` (expect `,1` or `,5` for registered) and `AT+CSQ` (signal strength). If not registered or no signal, fix antenna/SIM/location.
3. Ensure APN is correct for your operator (e.g. `internet` for CYTA).
4. Try activating PDP again: `AT+CGACT=1,1` then wait 510 s and `AT+CGPADDR=1`.
### ModemManager Not Detecting Modem
@@ -237,6 +296,7 @@ lsmod | grep -E '(cdc|qmi)'
| Path | Purpose |
|------|---------|
| `/usr/local/bin/connect-5g.sh` | Auto-connection script |
| `/usr/local/bin/troubleshoot-5g.sh` | Full diagnostic (logs + AT/USB checks) |
| `/etc/init.d/5g-router` | OpenRC service |
| `/var/log/5g-router.log` | Connection log |
| `/etc/iptables/rules.v4` | Firewall/NAT rules |