IPv6, DDNS and CGNAT: diagnose remote access before opening ports
Status: E2 for address diagnosis on a VM; E1 for DDNS, IPv6 remote access and real CGNAT. A private WAN plus a different public IP means NAT is in the path, not necessarily CGNAT. Do not promise “DDNS will work” before the public path is proven.
Step 1: compare WAN, public and IPv6
Section titled “Step 1: compare WAN, public and IPv6”ip -4 addr showip routeip -6 addr showip -6 route showifstatus wancurl -4 -sS https://ifconfig.mecurl -6 -sS https://ifconfig.coWhat to record:
- WAN IPv4 and default gateway;
- public IPv4 seen by an external service;
- global IPv6 address/prefix (not
fe80::link-local, notfd00::/8ULA); ifstatus wan→ipv6-address/ipv6-prefix;- whether the router has a real WAN interface or is behind another NAT.
Lab result:
WAN: 192.168.50.14/24 (RFC1918)public v4: 39.182.91.87IPv6: no global address/prefix; LAN ULA fd2f:385b:7d0a::/60This proves the router is behind NAT and has no usable global IPv6. It does not prove CGNAT: the upstream could be a normal home NAT.
Step 2: classify the access path
Section titled “Step 2: classify the access path”| Observation | Likely path | What to do |
|---|---|---|
| WAN is public and equals the public IP | direct public IPv4 | DDNS + firewall/port forward |
| WAN is private, public IP differs | NAT (possibly CGNAT) | check upstream; prefer IPv6 or relay |
WAN is 100.64.0.0/10 |
CGNAT range | no inbound IPv4; use IPv6/relay |
| Global IPv6 + delegated prefix | IPv6 path | AAAA DDNS + IPv6 firewall |
Only fe80::/ULA |
no global IPv6 | relay or public VPS |
Do not use “public IP differs” alone as a CGNAT diagnosis. Check the upstream router, the ISP contract, or a traceroute/port test.
Step 3: choose a remote-access design
Section titled “Step 3: choose a remote-access design”| Design | Works when | Cost/risk |
|---|---|---|
| DDNS + port forward | public IPv4, inbound allowed | exposed service; firewall discipline |
| IPv6 + AAAA DDNS | ISP delegates a global prefix and client has IPv6 | no NAT; firewall must allow only the service |
| WireGuard on a public VPS | CGNAT/no inbound; VPS reachable | VPS cost; relay bandwidth |
| Tailscale/ZeroTier-style overlay | CGNAT; no port forward | third-party coordination; client install |
| Reverse tunnel | outbound-only network | depends on tunnel provider; latency |
For this site’s WireGuard pages, the server needs a reachable endpoint; a CGNAT router cannot be the public endpoint without a relay/VPS.
Step 4: DDNS
Section titled “Step 4: DDNS”Install the client and provider package (names vary):
apk updateapk add ddns-scripts ddns-scripts-cloudflareA generic service section:
uci set ddns.myddns=serviceuci set ddns.myddns.enabled='1'uci set ddns.myddns.service_name='cloudflare.com'uci set ddns.myddns.domain='router.example.com'uci set ddns.myddns.username='<token-or-user>'uci set ddns.myddns.password='<token>'uci set ddns.myddns.ip_source='network'uci set ddns.myddns.ip_network='wan'uci set ddns.myddns.interface='wan'uci set ddns.myddns.use_ipv6='0'uci commit ddns/etc/init.d/ddns enable/etc/init.d/ddns restartlogread -fNotes:
ip_source/ip_networkand provider options differ; follow the provider’s DDNS script README;- use an API token with the minimum DNS scope, not the account password;
- for IPv6, set
use_ipv6='1'and usewan_6/the delegated prefix; do not publish a ULA; - check the provider’s “last update” and DNS TTL;
nslookupfrom outside; - DDNS updates a name; it does not create a public path.
Step 5: IPv6
Section titled “Step 5: IPv6”- Confirm a global address/prefix on WAN and LAN;
- allow only the required service in the IPv6 firewall; do not open the router admin UI;
- use AAAA DDNS for the global address, not the ULA;
- remember IPv6 has no NAT: every allowed port is directly reachable;
- prefix changes on reconnect; DDNS must track the current prefix/address;
- clients without IPv6 cannot use an IPv6-only path.
Step 6: verify from outside
Section titled “Step 6: verify from outside”From a different network (not the same LAN):
nslookup router.example.comcurl -6 -sS http://[2001:db8::1]/nc -vz router.example.com 51820- DNS may cache the old address; wait for TTL;
- a successful local test proves nothing about inbound NAT/firewall;
- if the public IP is shared/CGNAT, inbound IPv4 will fail even with DDNS.
Failure matrix
Section titled “Failure matrix”| Symptom | Check first | Common cause |
|---|---|---|
| DDNS shows private IP | ip_source/interface |
using WAN instead of public source |
| DDNS updates but unreachable | public path, port forward, firewall | CGNAT; port closed; wrong zone |
| No IPv6 address | WAN6, prefix delegation, ISP | no PD; firewall; client lacks IPv6 |
| IPv6 works locally, not outside | global vs ULA, firewall | AAAA points to ULA; blocked port |
| Address changes after reconnect | DDNS interval, prefix | stale record; provider TTL |
| WireGuard no handshake | endpoint, UDP, firewall | CGNAT; wrong port; no relay |
E2 lab run (2026-10-26)
Section titled “E2 lab run (2026-10-26)”- VM 200 WAN
192.168.50.14/24, gateway192.168.50.1(RFC1918). - Public IPv4 from
ifconfig.me:39.182.91.87; differs from WAN → NAT in path. - No global IPv6/prefix; LAN has ULA
fd2f:385b:7d0a::/60and link-local only. curl -6to an external service failed.- Not tested: real CGNAT, DDNS provider update, IPv6 firewall/AAAA, WireGuard over WAN, external client.
- Conclusion: diagnosis only; no remote-access success claim.
Security
Section titled “Security”- Do not expose LuCI/SSH to the internet;
- use keys, not passwords, for remote access;
- allow only the service port/zone; no DMZ/UPnP by default;
- a public IPv6 address is globally reachable unless the firewall blocks it;
- DDNS credentials are secrets; use scoped tokens and backups.
Sources
Independent OpenWrt notes. Every page states the firmware, device, package manager and way back.
Icons: Solar by 480 Design, CC BY 4.0