
Last Update: April 4, 2026
BY
eric
Keywords
Building a 4G/5G Backup Mobile Gateway with Alpine Linux on Old Hardware
How to repurpose an outdated PC into a reliable backup internet gateway using Android USB tethering
The Problem
Internet goes down. It always does at the worst possible time. However, even though that only happens a couple of times a year, an always-on 4G/5G backup isn't strictly necessary. It would be nice to have a plug-and-play solution—like using your phone (which probably has plenty of data) as a rescue for those few hours of downtime.
If you have a spare Android phone and an old PC gathering dust, you can build a proper backup gateway that kicks in when your main connection fails — no expensive hardware required.
This guide walks through the entire process, including the real-world gotchas encountered along the way.
Hardware Requirements
- An old/low-powered PC (sub 1GHz, even under 512MB RAM is workable)
- One or two ethernet NICs (two is ideal, one works fine)
- A USB port for the Android phone
- An Android phone with a mobile data plan
- A USB stick (2GB+ is plenty) to install from
For this project, I used a rugged industrial PC made by Advantech Australia. It's equipped with an Intel Atom D510 CPU and 2GB of memory. Its industrial build and dual NIC cards make it a perfect "warhorse" for a dedicated gateway role.

The machine used in this guide had two onboard NICs, an 8GB internal flash module (DOM — Disk on Module), and a larger hard drive set aside for backups. Very modest specs, perfectly adequate for a router role. Please execute me for the dust collected on this machine.
Why Alpine Linux?
For low-powered hardware doing a single job, Alpine Linux is the right tool:
- Boots in under 5 seconds
- Idles at ~30–50MB RAM
- Tiny base install (~130MB on disk)
- Uses OpenRC (no systemd overhead)
- The
rndis_hostkernel module handles Android USB tethering natively — no extra drivers needed - Actively maintained, security-focused
Other options like Debian minimal or OpenWrt on x86 are also viable, but Alpine wins on resource footprint for truly constrained hardware.
Network Topology
With two NICs the setup is clean — no double-NAT:
Android Phone (USB tethering)
|
| usb0
[Alpine Linux PC]
eth0 | eth1
| |
Your Router (spare / unused)
(WAN port)
With a single NIC, the same approach works — eth0 connects to your router's WAN port, usb0 is the phone. Your router handles the LAN side as normal. The Alpine box just NATs between usb0 and eth0.
Note on double-NAT: With a single NIC and a typical home router, you'll have three layers of NAT (phone → Alpine → router). For general internet use this is completely fine. Port forwarding gets complicated, but for a backup scenario it's a non-issue.
Step 1: Creating the Install USB
Download the Alpine Linux "standard" x86 ISO from alpinelinux.org.
Write it to a USB stick using dd:
dd if=alpine-standard-x.x.x-x86.iso of=/dev/sdX bs=4M status=progress
Replace /dev/sdX with your USB stick's device. Double-check this — dd will happily wipe whatever you point it at.
Important: Use
dddirectly, or Rufus in DD mode if on Windows. Do not let Rufus create a FAT32 partition layout — old BIOSes can choke on it. Alpine ISOs are hybrid MBR images and work correctly when written raw.
Step 2: BIOS Boot Gotchas (American Megatrends)
Old AMI BIOS boards have a few quirks that can stop USB boot from working even when USB is set as first priority:
- Plug the USB in before powering on. USB drives often only appear in the boot device list if they're present at POST time.
- Check for two separate boot priority menus. AMI BIOS often has a top-level device-type priority (Removable → HDD → CD) and a separate submenu for ordering within each type. The USB stick needs to be first in both places.
- Enable Legacy USB Support — usually found under Advanced or Integrated Peripherals.
- Use a rear USB 2.0 port. Front panel ports and USB 3.0 ports are often ignored by old BIOSes during boot enumeration.
- Use a USB 2.0 flash drive if possible. USB 3.0 sticks can fail to enumerate on old BIOSes.
- Try the one-time boot menu first — on most AMI boards, hit F8 or F11 at POST. This bypasses the boot order entirely and lets you pick the USB stick directly, which is useful for confirming the stick itself is bootable before adjusting BIOS settings.
In my case, I was finally able to have it boot into the Alpine Linux installation interface after plugging the USB drive into the back (rear) of the machine.
Step 3: Identifying Your Disks
Once booted into the Alpine live environment, identify your drives before installing:
cat /proc/partitions
Example output:
8 0 312571224 sda ← ~150GB (Windows drive)
8 16 7880544 sdb ← ~7.5GB (target install drive)
8 32 3910656 sdc ← ~3.7GB (Alpine USB stick)
To confirm the nature of a drive — particularly whether it's a USB device or an internal flash module:
dmesg | grep sdb
If the output references sd X:X:X:X (SCSI enumeration) rather than usb-storage, the drive is connected internally — likely a DOM (Disk on Module), common on older appliance-grade hardware. These are perfectly fine for Alpine and handle the low write workload of a router OS well.
Tip: A drive formatted as FAT32 with write cache disabled and a single partition spanning the whole disk is a typical signature of a factory-installed DOM or embedded flash device.
Step 4: Installing Alpine
Run the setup script:
setup-alpine
Work through the prompts:
- Keyboard layout: your preference
- Hostname: something useful, e.g.
mobile-gateway - Network interface: configure
eth0for DHCP during install; skipeth1for now - Root password: set something strong
- Timezone: your local timezone
- NTP client: choose chrony (see note below)
- Mirror: pick a geographically close one or
rfor auto-detect - SSH:
opensshis fine - Disk mode: type
sys— this is a standard permanent install to disk - Which disk: type the device name of your target drive (e.g.
sdb)
The installer will wipe the selected disk and install Alpine. When finished, remove the USB stick and reboot.
Why chrony for NTP?
For a machine that's offline frequently or has intermittent connectivity — exactly the backup router use case — chrony is the best choice. It handles time jumps gracefully when connectivity comes and goes, and compensates for clock drift between connections. busybox-ntpd is too basic for this, and openntpd handles irregular connectivity less gracefully than chrony.
Step 5: Post-Install — Making It Boot
If the machine boots back into another OS after install, the BIOS is still preferring the wrong drive. Go back into BIOS and find the Hard Disk Drive Priority submenu — set your Alpine drive (the 8GB/DOM one) as first in that list.
Use the one-time boot menu (F8/F11) to test first — select your Alpine drive directly to confirm it boots before making the BIOS change permanent.
Step 6: Configuring USB Tethering
Plug in the Android phone and enable USB Tethering from the phone's settings (usually under Settings → Network → Hotspot & Tethering).
The Alpine kernel will load rndis_host automatically and a new interface will appear — typically usb0:
ip link show
Bring it up and get an IP via DHCP from the phone:
udhcpc -i usb0
Test connectivity:
ping -c 3 1.1.1.1 -I usb0
Step 7: NAT and IP Forwarding
Install iptables if not already present:
apk add iptables
Enable IP forwarding:
echo 1 > /proc/sys/net/ipv4/ip_forward
Set up NAT (assuming usb0 = WAN, eth0 = LAN out to router):
iptables -t nat -A POSTROUTING -o usb0 -j MASQUERADE
iptables -A FORWARD -i eth0 -o usb0 -j ACCEPT
iptables -A FORWARD -i usb0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
Make IP forwarding persistent — add to /etc/sysctl.conf:
net.ipv4.ip_forward = 1
Save and persist iptables rules across reboots:
rc-update add iptables
/etc/init.d/iptables save
Step 8: Hotplug Script (Plug In and It Just Works)
Rather than running commands manually every time, Alpine's mdev can detect when the phone is plugged in via USB and automatically bring up the tethering interface and routing.
Create /etc/mdev/usb-tether.sh:
#!/bin/sh
# Called by mdev when a USB network interface appears
IFACE="usb0"
if [ "$ACTION" = "add" ] && ip link show "$IFACE" > /dev/null 2>&1; then
udhcpc -i "$IFACE" -q
iptables -t nat -A POSTROUTING -o "$IFACE" -j MASQUERADE
iptables -A FORWARD -i eth0 -o "$IFACE" -j ACCEPT
iptables -A FORWARD -i "$IFACE" -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
fi
Make it executable:
chmod +x /etc/mdev/usb-tether.sh
This gives you plug-in activation — connect the phone, USB tethering enables on the phone, and the gateway comes up automatically. Unplug to deactivate.
Second NIC — What to Do With It
If your machine has two NICs, you have more flexibility:
- eth0 — connect to your router's WAN port (LAN out)
- eth1 — leave unconfigured unless you need a second downstream device connected directly
There's no need to bridge or assign an IP to eth1 for a basic single-router setup. Leave it unconfigured and use it later if needed.
Summary
The end result is a machine that sits quietly on the shelf, draws minimal power, and becomes a functional mobile gateway the moment you plug a phone into it — no GUI, no fuss, no expensive hardware.
Built and tested on an old low-powered PC with AMI BIOS, dual onboard NICs, and an internal DOM flash drive. Alpine Linux 3.x.





Comments (0)
Leave a Comment