Website Accessible Internally but Not Externally: A Four-Layer Troubleshooting Method
This article presents a four-layer troubleshooting method for the common issue where a website loads on the internal network but is unreachable from the public internet. It explains why restarting the service rarely helps, then walks through checking the service listening address, the host firewall, the egress gateway and address mapping, and ISP or compliance restrictions. Each layer includes verification commands, pass/fail criteria, and real-world comparisons so you can stop and fix the problem at the exact layer where it fails.
1. The Conclusion First: Why Restarting Does Not Help
The symptom “accessible internally, unreachable externally” is itself a high-value signal. It tells you that the web service process has started normally, the listening port is available, the application code has no fatal errors, and the local loopback access path works. This is why restarting the web service or the entire machine usually has no effect: the fault is not in the application layer, but on the path that goes from the server out to the public internet.
The correct approach is to troubleshoot by layer. Break the entire path into four layers—application listening, host firewall, network egress and address mapping, and ISP plus compliance policies—and verify them one by one from the inside out. Each layer has a clear pass/fail criterion. As soon as one layer fails, stop and fix it; there is no need to keep checking outward.
2. Layer 1: The Service Listening Address Range
Internal access working means the listening address is most likely fine, but you still need to confirm it, because it is the prerequisite for all subsequent checks.
On the server, check port usage and the listening address:
# Linuxss -tlnp | grep ':80'# Windowsnetstat -ano | findstr :80
Pass/fail criteria:
0.0.0.0:80or[::]:80means the port is open on all network interfaces, which is the expected state for serving external traffic.127.0.0.1:80means only the local machine can access it. External requests are rejected outright, typically producing a Connection refused error.- A specific internal address means only requests arriving from that address range receive a response.
If you use a graphical site management tool, also check the site’s binding configuration. If a specific IP is hard-coded in the binding, requests from other addresses get no response. If a specific hostname is entered, the site must be accessed with that domain. When in doubt, changing the IP to “All Unassigned” is the safest option.
Test comparison: port 8081, listening on the loopback address only, had external connections refused. After changing to port 8082, listening on all addresses, the page loaded normally from outside.
3. Layer 2: The Server’s Host Firewall
Internal access working means the firewall has at least allowed internal traffic. What you really need to confirm is whether the rule scope is restricted to the internal subnet.
On Linux, check the effective rules of three common firewalls:
firewall-cmd --list-all # Show what the default zone allowsufw status verbose # Show status and default policiesiptables -S # Show the underlying rule chains
On Windows, open Windows Defender Firewall with Advanced Security, go to inbound rules, find the entries for ports 80 and 443, and focus on whether the remote IP in Scope has only “Local subnet” selected.
Pass/fail criterion: if a rule is limited to private ranges such as 192.168.x.x, 10.x.x.x, or 172.16~31.x.x, that is the root cause.
Test comparison: a test cloud host was reachable externally with the host firewall disabled. After enabling it without opening the port, external access reported No route to host. Opening the port immediately restored a 200 response. Note that a temporary rule stops working after a reboot; a permanent rule must be written and the configuration reloaded:
firewall-cmd --add-port=8082/tcp # Temporary openingfirewall-cmd --permanent --add-port=8082/tcp # Permanent openingfirewall-cmd --reload # Reload configuration
Also distinguish two easily confused symptoms: Connection refused usually means the port is not listening or the firewall actively rejected the connection; connection timeout or no route usually means dropped packets, missing address mapping, or the path being blocked.
4. Layer 3: The Egress Gateway and Address Mapping
If the server holds a private address, external access depends on two things: the egress has a public address, and a port mapping to the internal address is configured on the egress device or the cloud platform’s network access controls.
Confirm the following in order:
- Whether the egress has an available public IP (a self-built data center needs to request one from the access provider; a cloud environment typically obtains one through an elastic public IP address).
- Whether the egress router, hardware firewall, or the cloud platform’s security groups and network ACL allow ports 80/443.
- Whether the target address and port in the port forwarding (virtual server) rule point to this machine.
- Whether multiple egresses or dual NICs cause reply packets to take the wrong path—that is, the request comes in on interface A but the response goes out on interface B and is dropped by the peer.
In cloud environments, pay special attention: security groups are stateful, so usually only inbound rules need to be opened; subnet-level network ACLs are stateless, so you must open both the inbound and outbound ephemeral port ranges. Cases where it still does not work with only the security group configured are mostly caused by this.
5. Layer 4: ISP and Compliance Policies
Even if the first three layers are all correct, it may still be unreachable. Common reasons include:
- Home broadband or ordinary commercial broadband has common web ports such as 80 and 443 blocked, so you need to switch to another port or upgrade the line type.
- An unregistered domain and public IP cannot serve web traffic in mainland China.
- Regional access restrictions or traffic scrubbing policies exist along the path.
How to verify: from outside, use ping and traceroute (tracert on Windows) to see at which hop the path breaks; use an external port scanning service to check whether the port is reachable. If internal access works but external access times out entirely after a certain hop, it is basically a path or policy problem rather than a server configuration problem.
6. Recommended Troubleshooting Order and Summary
Follow the order: listening address, host firewall, egress mapping and security groups/ACL, then ISP and compliance. Make one clear judgment per layer and avoid blind restarts. In a cloud environment, combine monitoring alerts and log services to see whether requests reach the server: if the logs contain no external request records at all, traffic is not reaching the machine and the problem is in Layer 3 or 4; if records exist but responses are abnormal, go back to Layer 1 or 2. With this order, most “accessible internally, unreachable externally” problems can be located within ten minutes.
