Skip to content

About

Fixes the silent death of IPV6 on the RM520N-GL Quectel Modem in ECM. This problem does not exist on the RM500/502.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

520 IPv6 Fix — 6relayd / radvd passthrough

License Platform Install

Fixes the "silent IPv6 death" on the Quectel RM520N-GL: the stock QCMAP-managed radish keeps running but silently stops sending Router Advertisements, so LAN clients never get — or never keep — a global IPv6 address.

What's actually wrong

Quectel's firmware uses radish to advertise the carrier /64 to LAN clients. On many units it stops advertising entirely after a while, and because the radish RAs carry infinite lifetimes, stale prefixes also never expire on clients. Result: test-ipv6.com scores 0/10 while the modem itself is perfectly healthy — Windows just picks a dead prefix as its source address.

This project replaces radish's advertising job with a self-managed radvd that:

  • reads the carrier /64 from the data interface (rmnet_data0/1/2)
  • routes it to bridge0 with the WAN's autoconf=0, so the /64 is never claimed on-link on the WAN (the ambiguity that breaks return traffic)
  • advertises it with radvd (RDNSS: Cloudflare 2606:4700:4700::1111)
  • enables proxy_ndp on the LAN bridge so downstream routers (and their clients) can receive return traffic — restoring the ND-proxy that radish provided
  • withdraws stale prefixes — when the carrier hands out a new /64 on a re-dial, old prefixes are re-advertised with zero lifetimes so clients drop them immediately instead of stalling for hours
  • strips QCMAP's ULA so clients hold a clean single global
  • survives reboots and re-dials (prefix state persisted to /usrdata/at-stock-ui/ipv6.prefix)

Scope

This fix is for the RM520N-GL in ECM (Ethernet Control Mode) (AT+QCFG="USBNET",1). This works both when installed inside a router via USB m.2 slot (AT+QCFG="pcie/mode",0) or in an m.2 to RJ45 adapter via PCIE/eth driver (AT+QCFG="pcie/mode",1 and AT+QETH="eth_driver","r8125",1), where the modem presents a plain Ethernet link to its host and uses radish to advertise the carrier /64 to downstream devices. If your modem is in MBIM or QMI mode, this fix has not been tested and may not apply.

Requirements

  • Quectel RM520N-GL modem with SSH or ADB root access
  • radvd — the installer auto-installs it via opkg (Entware) if the firmware build shipped without it
  • Your carrier must route a /64 to the modem (verified across T-Mobile, Verizon, and AT&T). If your carrier hands out only a single address or an on-link /64, the routed-passthrough model doesn't apply.

Not for firmware that already relays natively. Some Quectel lines (e.g. RM502Q-GL) ship a working radish in relaying mode (-x): the carrier /64 is routed at the firmware layer and IPv6 just works with no host-side scripts. The installer refuses to run there (it detects the relaying radish and aborts), because adding this fix would double the RA sources — the exact duplicate-RA condition it exists to prevent.

Install — one command, run ON the modem

curl -fsSL https://raw.githubusercontent.com/carp4/520-ipv6-fix/main/install-on-device.sh | sh
  • SSH into the modem as root first, then paste the line.
  • It asks for confirmation first (1 = install, 0 = exit) and never installs blindly: it prompts on the interactive terminal (root shell, adb shell, or curl ... | sh pasted at a terminal), and a non-TTY run (e.g. printf '1\n' | ssh root@<modem> 'sh /tmp/install-on-device.sh') accepts one confirmation line from stdin, so no pty is required.
  • Idempotent — safe to re-run on an already-fixed modem.
  • No reboot required. The service starts immediately and survives reboots (persistent rootfs + manual wants symlinks, see below).

Prefer deploying from a laptop? The repo also ships a one-shot SSH driver:

./install-ipv6-fix.sh <modem-ip> [ssh-user]

CRITICAL: how boot persistence works on this firmware

The units always live in /lib/systemd/system/ (the rootfs). The installer remounts the rootfs rw if it looks read-only. This matters because on these firmware builds /etc is a separate UBI volume that mounts after systemd has processed the boot transaction — systemctl enable writes into /etc/systemd/system/*.wants/, which boot systemd never scans, so units enabled there silently never start (observed: enabled + symlink present + reboot → inactive (dead), NRestarts=0). Enabling is therefore done by manual wants symlinks in /lib, and systemctl is-enabled will lie.

The installer also keeps identical mirror copies in /etc/systemd/system/: systemd prefers /etc over /lib, but identical copies make that preference harmless, and the /etc copies are what survive an OTA that wipes /lib — they're the reapply script's recovery source. Never let the two diverge.

Verify

sh /usrdata/at-stock-ui/6relayd-ctl.sh status   # one-shot state summary
systemctl is-active rm520-6relayd.service        # active
systemctl is-active rm520-6relayd-watchdog.timer # active
cat /tmp/lp-radvd.pid                            # radvd pid (alive)
radvd -c -C /tmp/lp-radvd.conf                   # config: syntax ok
cat /usrdata/at-stock-ui/ipv6.prefix             # current carrier /64
ip -6 addr show bridge0                          # globals being served

6relayd-ctl.sh status is the recommended check — it reports service/timer state, boot-persistence symlinks, the run + radvd daemons (pid, alive, real radvd, process count), config validity, the active WAN and its autoconf pin, the current vs recorded prefix, and the /64 route — all in one shot.

Note: ps w | grep radvd shows two processes — radvd 2.18 forks a child even in -n mode. That pair is normal; the pidfile owns the parent.

After a firmware update (OTA)

A firmware update wipes /lib (rootfs). Re-apply on the modem with:

sh /usrdata/scripts/reapply-ipv6-relay.sh

It restores the units from the /etc mirrors and re-creates the wants symlinks, and restarts the service.

Turn off / undo

The relay's undo is symmetric and one command (see 6relayd-ctl.sh):

sh /usrdata/at-stock-ui/6relayd-ctl.sh off       # stop+disable all units + reclaim radvd + run loop, restore autoconf, drop boot symlinks
sh /usrdata/at-stock-ui/6relayd-ctl.sh on        # start service + watchdog (re-pins everything)
sh /usrdata/at-stock-ui/6relayd-ctl.sh status
sh /usrdata/at-stock-ui/6relayd-ctl.sh uninstall # full remove of the fix

off matters most on T-Mobile / 464XLAT payloads: the modem itself lives on IPv6 (the ULA + CLAT path rides rmnet_data0), and the relay pins autoconf=0 on the WAN. If the relay is stopped without restoring autoconf, the modem stops acquiring its own IPv6 after the next re-dial — stranding the box's management/visibility on its only address family. off restores autoconf=1 on rmnet_data0/1/2, drops proxy_ndp, removes the /64 route, stops and disables every unit, reclaims every radvd and the run loop, and removes the boot wants symlinks in both /lib and /etc so the relay stays off across reboots. LAN clients lose IPv6 while the relay is off — that's expected; the modem's own stack is what's being un-stranded. on restores the boot symlinks and everything else.

uninstall is the full symmetric remove: it runs off, then deletes the unit files, wants symlinks, scripts and runtime state from both unit dirs and /usrdata, and re-asserts the host-side state. It leaves the radvd binary installed (opkg remove radvd if nothing else uses it).

(The watchdog fires every 60s, so a manual systemctl stop rm520-6relayd alone is not a reliable way to keep it off — use 6relayd-ctl.sh off, which also stops the timer and drops the boot symlinks.)

Files

File Purpose
6relayd-run.sh Main loop: prefix tracking, routing, radvd, stale-prefix withdrawal
6relayd-watchdog.sh Restarts the service if it dies
6relayd-ctl.sh status / on / off / uninstall control surface — including the symmetric undo (autoconf restore) that the relay's WAN pin requires, and the full remove
rm520-6relayd.service Runs the main loop, Restart=always
rm520-6relayd-watchdog.service / .timer Watchdog, every 60s (OnBootSec=90)
install-on-device.sh Self-contained on-device installer (the one-liner)
install-ipv6-fix.sh SSH deployer for laptop use
reapply-ipv6-relay.sh Post-OTA re-apply helper

Notes

  • Verified across T-Mobile, Verizon, and AT&T (whole-/64 routed to the modem). Other carriers may behave differently.
  • License: MIT — use it, fix it, share it. No warranty, and test on a unit you can afford to reboot before trusting it with your main line.

About

Fixes the silent death of IPV6 on the RM520N-GL Quectel Modem in ECM. This problem does not exist on the RM500/502.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages