Hi,

I seem to be completely stumped here.
I have a server with CentOS 5.4 installed with CPanel and I can access my CPanel admin with
I also have a test site that I have created using CPanel (let's call it testsite.com).

Now here is the problem:
I can access testsite.com from outside of the LAN but not within the LAN! Is there some kind of setup I have to do with my router to correct this?

Dani AI

Generated

A quick, focused checklist that complements the thread: ’s hosts-file workaround shows the server is reachable on the LAN but that name resolution inside the LAN behaved differently than from the Internet. When a site is reachable externally but not from inside, the most common causes are the router not supporting NAT loopback (hairpin NAT) or the LAN clients resolving the domain to the public IP instead of the server’s private IP.

Basic diagnostics to run from the problem client (observe the IP that the name resolves to and whether connections reach the server):

nslookup example.com
ping example.com
tracert example.com   (Windows) / traceroute example.com (Linux)
curl -I http://example.com/
curl --resolve example.com:80:192.168.x.x http://example.com/

What those tell you: nslookup shows which IP the client is using; traceroute shows whether traffic goes out to the gateway; curl --resolve forces a name-to-IP mapping for a single test without changing the hosts file (handy to simulate an internal DNS override).

Practical fixes and checks (short, prioritized):

  • If the domain resolves to your public IP from inside, the router likely lacks hairpin NAT. Look for a “NAT loopback/DNS host override” or “Local DNS” option in the router GUI and add an entry for the domain pointing to the server’s LAN IP.
  • Run a small local resolver (dnsmasq / Pi-hole / internal BIND split-horizon) and point DHCP clients at it for a permanent split-horizon solution.
  • Verify the server isn’t refusing LAN connections: check Apache virtual hosts (apachectl -S) and firewall rules (iptables -L -n -v on CentOS 5.x).
  • If a hosts-file edit didn’t help on a client, consider IPv6 resolution or browser DNS-over-HTTPS/proxy/VPN behaviour that can bypass the OS hosts file.

Caution: changing router DNS or DHCP affects all clients — test carefully. These steps explain why the hosts-file quick fix sometimes works and provide more robust, network-wide solutions for reliable internal access.

I fixed it,
I added the server's local IP address to my hosts file with the url and restarted apache.

The hosts file didn't help with my site... Can I do anything else? Only me can not access the site, really strange!!! Here it is:

I also cleared my DNS cache with CMD - ipconfig /flushdns

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.