# Alpine 5G Router – Quick Start

Get a new device from zero to 5G router in a few steps.

## Prerequisites

- Raspberry Pi 5 (or compatible) with Alpine Linux installed
- Fibocom FM350-GL modem connected via USB (Mode 40: 0e8d:7126)
- SIM card with data (e.g. CYTA Cyprus, APN `internet`)

## 1. Clone repo on the device (or copy files)

```bash
# If you have git on the device:
git clone https://github.com/YOUR_USER/Alpine_5G.git /tmp/Alpine_5G
cd /tmp/Alpine_5G

# Or: copy the repo (e.g. scp -r Alpine_5G root@device:/tmp/)
```

## 2. Install packages (on the device)

```bash
# Enable community repo if needed
sed -i 's|#.*community|http://mirrors.neterra.net/alpine/v3.23/community|' /etc/apk/repositories
apk update

# Core packages
apk add iptables python3 py3-flask
pip install pyserial

# Optional: dnsmasq for LAN DHCP/DNS, speedtest-cli for speedtests
apk add dnsmasq speedtest-cli
```

## 3. Run install script

From the repo root:

```bash
cd /tmp/Alpine_5G
chmod +x scripts/install.sh
./scripts/install.sh
```

This installs:

- `/etc/5g-router.conf` (from example – edit if needed)
- `/usr/local/share/5g-webgui/` – Web GUI with integrated connection management
- `/etc/init.d/5g-webgui` (OpenRC service – handles both Web GUI and 5G connection)
- `/etc/iptables/rules.v4`
- Enables `5g-webgui` at boot

## 4. Edit config (if needed)

```bash
vi /etc/5g-router.conf
```

Set at least:

- `APN` – e.g. `internet` for CYTA
- `WAN_IF` / `LAN_IF` – default `eth1` and `eth0.100` are usually correct

Optional:
- `WATCHDOG_INTERVAL=60` – check connection every 60s and reconnect if needed
- `FAILOVER_ENABLED=yes` and `FAILOVER_IF=eth0` to use ethernet when 5G is down

## 5. Start Web GUI (includes 5G connection)

```bash
service 5g-webgui start

# Check status
/usr/local/bin/status-5g.sh

# Test connectivity
ping -c 3 8.8.8.8
```

## 6. Access Web GUI

Open **http://\<device-ip\>:5000** in your browser.

- **admin** / **admin** – full access
- **support** / **support** – view-only + restart 5G

**Change passwords after first login!**

## 7. Enable iptables restore at boot (if not already)

```bash
rc-update add iptables-restore default
```

## Done

The device will bring up 5G at boot via the Web GUI service. Manage via web interface at port 5000.

To restart 5G: use the Web GUI, or `service 5g-webgui restart`.

For full docs see [README.md](../README.md), [WEBGUI.md](WEBGUI.md), and [5G_MODEM_TROUBLESHOOTING.md](../5G_MODEM_TROUBLESHOOTING.md).

---

## Legacy: Standalone 5g-router service

If you prefer to run without the Web GUI, you can still use the legacy service:

```bash
rc-update del 5g-webgui default
rc-update add 5g-router default
service 5g-router start
```

This runs `connect-5g.sh` without the web interface.
