Skip to content

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.

Terminal window
ip -4 addr show
ip route
ip -6 addr show
ip -6 route show
ifstatus wan
curl -4 -sS https://ifconfig.me
curl -6 -sS https://ifconfig.co

What to record:

  • WAN IPv4 and default gateway;
  • public IPv4 seen by an external service;
  • global IPv6 address/prefix (not fe80:: link-local, not fd00::/8 ULA);
  • 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.87
IPv6: no global address/prefix; LAN ULA fd2f:385b:7d0a::/60

This 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.

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.

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.

Install the client and provider package (names vary):

Terminal window
apk update
apk add ddns-scripts ddns-scripts-cloudflare

A generic service section:

Terminal window
uci set ddns.myddns=service
uci 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 restart
logread -f

Notes:

  • ip_source/ip_network and 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 use wan_6/the delegated prefix; do not publish a ULA;
  • check the provider’s “last update” and DNS TTL; nslookup from outside;
  • DDNS updates a name; it does not create a public path.
  • 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.

From a different network (not the same LAN):

Terminal window
nslookup router.example.com
curl -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.
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
  • VM 200 WAN 192.168.50.14/24, gateway 192.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::/60 and link-local only.
  • curl -6 to 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.
  • 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

Router.Homes

Independent OpenWrt notes. Every page states the firmware, device, package manager and way back.

Icons: Solar by 480 Design, CC BY 4.0