Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
    
It would be helpful to know what changes you made to the router to make it work externally. –  uSlackr Jun 2 '11 at 15:59
    
I opened up port 80 and 443 to make the webserver work externally. –  Chad Whitaker Jun 2 '11 at 19:18

3 Answers 3

up vote 0 down vote accepted

This effect is due to hairpin NAT. http://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.

share|improve this answer

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

share|improve this answer
    
Would this mean I would want to install a local DNS server and point my router to the local DNS? –  Chad Whitaker Jun 2 '11 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. –  Joseph Redfern Jun 2 '11 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) –  RedGrittyBrick Jun 2 '11 at 22:33

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

share|improve this answer
    
I understand. Although what could I implement on the network so that example.net would work the same on and off the local network. –  Chad Whitaker Jun 2 '11 at 19:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.