views:

1212

answers:

3

I have an ASP.NET website hosted at home on IIS. Outside my home network i can see the website, but inside the network it gives me a 404 error. I can browse the site as localhost. It seems like a DNS problem, just not sure how to fix it.

+2  A: 

The externally visible IP address that you've presumably pointed your domain to is really the IP address of your router or cable modem. External connections will be routed to the machine with IIS on, but when you connect from inside the network you'll get the router's own web server with its admin interface. That's unlikely to have a page matching the URL you requested, so you'll get a 404.

You should be able to fix it by adding an entry to the hosts files of your home machines to map your domain to the internal IP of the machine with IIS on, overriding the external IP in the DNS entry.

stevemegson
+4  A: 

That's almost certainly a NAT problem. I assume your web server sits behind a NAT router and you've forwarded some port (probably 80) from the external interface of the router to port 80 on your server machine. I also assume you're trying to access your website either using a name which resolves to your external IP (probably a dynamic DNS name), or you're trying to access it directly using that external IP. This will probably not work out of the box since most NAT routers will only make the port mapping available for packets coming in on the router's external interface.

If the above holds true, there are four possible solutions:

  1. Look at your router's configuration and try to find something akin to "NAT loopback", "Ext-int loopback" or the like. That will instruct the router to handle packets coming in from the internal interface and destined for the external IP just as it would handle packets coming in from the external interface, effectively correctly looping back the traffic. That will trigger the port forwarding and your site will work. Not all routers have this option, but if yours does it would be the most robust solution. If yours doesn't, you could also try to change its firmware to one of the free ones out there which supports your router (Tomato, OpenWRT, DD-WRT, etc.) I've used Tomato successfully for such scenarios.

  2. Use the internal IP when you're behind the router and the external one when outside.

  3. Add the DNS name you're using to your own hosts file making it correspond to the internal IP. This will achieve (3) automatically when accessing the name from your own host. You will have to repeat this for every single host behind your router.

  4. Run your own DNS server behind the router, make it claim authority over your DNS record and resolve it to the internal IP, while forwarding the other DNS queries to your actual name server.

Mihai Limbășan
A: 

There is another way to make your server visible from the internet.

Check www.hostingathome.com for a simple solution.

Jakub