Networking: Server reachable from the internet but not from inside the LAN via its public IP — NAT loopback / hairpin NAT not working
Devices on your own network can't use the router's public address to reach a server that is also on that network.
NAT loopbackNAT reflection not workingworks from outside but not from inside the networkcan't access my server using its public IP from LAN Meaning
The router doesn't support NAT reflection (hairpin NAT), or replies bypass it. Use split DNS (internal name → private IP), enable NAT loopback/reflection on the router, or add a hairpin SNAT rule. Testing from your phone on mobile data tells you whether external access works at all.
Common causes
- Router lacks NAT loopback/hairpin
- DNS returns the public IP inside the LAN
- Asymmetric reply path from the server
- Firewall rule only for the WAN interface
- Port forward configured for the wrong interface
⚡ Quick fix
- Use split-horizon DNS for the internal name
- Enable NAT reflection on the router
- Or add a hairpin SNAT/masquerade rule
Detailed fix by platform
Linux
sudo iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -d 192.168.1.50 -p tcp --dport 443 -j MASQUERADE
How to diagnose
- Internet access — Works?
- LAN via public IP — Fails?
- DNS — Internal override?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- arp -a shows (incomplete) Networking: `arp -n` shows (incomplete) / Destination Host Unreachable — no ARP reply from the next hop
- Domain still resolves to the old IP (DNS propagation/cache) Networking: DNS changed but the domain still resolves to the old IP — TTL and resolver caching ("propagation")
- Idle connections silently dropped by firewall/NAT Networking: Connection works, then fails after being idle — firewall/NAT idle timeout dropped the TCP session (use keepalive)
Most viewed in Networking
- Native VLAN mismatch / wrong VLAN, no connectivity Networking: %CDP-4-NATIVE_VLAN_MISMATCH / device on the wrong VLAN can't reach the gateway
- Port err-disabled (psecure-violation) Networking: %PM-4-ERR_DISABLE: psecure-violation error detected on Gi0/5, putting Gi0/5 in err-disable state
- Rogue DHCP server hands out wrong gateway/DNS Networking: Clients receive the wrong default gateway or DNS server — a rogue DHCP server (often a home router) answers first
Other ways to find it
Where this error sits
Origin: Network. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 5 Nov 2026