0

I recently set up a web server on my office network with a domain let's say example.net

Everything works perfect outside of the network when I visit example.net, it connects to the webpage just fine.

Although when I visit example.net while on the same network as the webserver it pulls up my Comcast Business router's configuration page.

What would I need to do in order to have example.net route to the proper IP and pull up the web server and not the router.

Thank you.

2
  • It would be helpful to know what changes you made to the router to make it work externally.
    – uSlackr
    Jun 2, 2011 at 15:59
  • I opened up port 80 and 443 to make the webserver work externally. Jun 2, 2011 at 19:18

3 Answers 3

0

This effect is due to hairpin NAT. https://serverfault.com/search?q=hairpin+nat

Externally the firewall/router handles it fine, but internally, you need to point at the local internal IP address.

2

The DNS name probably resolves to the external IP-address of the router, where port-forwarding rules forward the traffic to the internal IP-address of your web-server.

You need to use the internal IP-address or an internal name when on the web-server LAN or you need to implement split-DNS - configure your LAN DNS service to resolve www.example.net to the internal IP-address.

UPDATE: Or, as Joseph mentions in a comment, add an entry to the hosts file on any PC on your office LAN that needs access to the webserver. Usually C:\Windows\System32\drivers\etc\hosts

3
  • Would this mean I would want to install a local DNS server and point my router to the local DNS? Jun 2, 2011 at 19:54
  • That does seem slightly... overkill. How many machines are on the network? It might be worth manually editing each machines hosts file, to make example.net point to the internal IP of the machine. Jun 2, 2011 at 20:04
  • @Chad, Joseph is right, if your office LAN doesn't have a DNS server already then there's no need to add one. Just add a hosts file entry to any PC that needs to access your web-server. The usual location on Windows PCs is C:\Windows\System32\drivers\etc\hosts (see hosts.sam for sample entries) Jun 2, 2011 at 22:33
0

Your DNS is resolving to the IP of your router which in turn is forwarding the connections to the web server. When you attempt to access it from inside the network, it's going to the configuration page because you are part of the network. To access the web server from inside your network, you need to use the internal IP of the web server.

UPDATE:

This question attempts to answer your problem: Access internal IP using public IP

1
  • I understand. Although what could I implement on the network so that example.net would work the same on and off the local network. Jun 2, 2011 at 19:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .