3

I want to host a small personal website at home. One basic problem I am hitting is, From inside home network, I cannot access my domain name. I have to use the local ip (something like 192.168.1.4) to access the website. This ip is the desktop which is hosting the website. Because of this mapping, I have issues setting up a simple wordpress blog on it too.

How do I get past this issue?

edit:0 when I try to access www.example.com (my domain) from within my home network, I get redirected to my router login.

PS: 1) I am using dyndns service to map my non-static ip to my domain name. 2) My portforwarding works fine.

9 Answers 9

8
+50

On your computer inside your router setup an entry in your hosts file to point to your server's internal ip address. This means that it overrides the DNS entry from the public internet.

8
  • You mean my server (where I am hosting my site - www.example.com) behind the router should have an entry in its /etc/hosts file, right? can you please give me an example? my server's internal ip is 192.168.1.4. How should the entry look?
    – hari
    Commented May 27, 2012 at 23:16
  • 192.168.1.4 www.example.com
    – Noodles
    Commented May 27, 2012 at 23:44
  • Tried that, its still pointing to the router login.
    – hari
    Commented May 27, 2012 at 23:53
  • You may need to restart your browser, it has its own DNS cache. You can try and ping www.example.com and see if it returns the correct ip. If in doubt reboot your computer.
    – Noodles
    Commented May 28, 2012 at 3:21
  • I tried clearing cache. ping to www.example.com returns my external public ip. Does that sound correct?
    – hari
    Commented May 28, 2012 at 19:27
5

According to ref 1, ref 2, port forwarding only works from an external network. Just use the local IP for testing purposes. There's nothing wrong with your configuration; it's just the way port forwarding is designed.

5
  • 1
    On another note: your ISP's Terms of Use likely forbid running any kind of server from your residence. There are plenty of free (or nearly free) alternatives. For example, Google App Engine, or Amazon AWS.
    – Wackidev
    Commented May 21, 2012 at 22:15
  • I have no clue where you are heading with your answer. Sorry but it does not make sense.
    – hari
    Commented May 23, 2012 at 7:05
  • Your problem could be the result of a hundred different things. I just listed the first few things I would do if I were you. Have you tried any of them?
    – Wackidev
    Commented May 24, 2012 at 13:20
  • 1
    No problem. If you provide more information I may be able to suggest a more effective remedy. What does it say when you try to access your domain? "Server not found" "404" "Page doesn't exist" etc. (BTW: If you're using IE it sometimes isn't as informative as Chrome or Firefox. You might want to try using one of those for a more helpful readout.)
    – Wackidev
    Commented May 25, 2012 at 22:56
  • updated my question with edit0.
    – hari
    Commented May 27, 2012 at 19:07
2

If you don't want to play with hosts file, Split DNS is the solution.

The easiest way is to install Dnsmasq on your local server and reconfigure DHCP on your router to to use it as DNS server.

Dnsmasq should forward queries to send queries to your name servers, then study configuration file how to override DNS records.

2

On the computer you are using to access your server (not on the server itself) add a line to its hosts file like:

192.168.1.4 www.example.com

Depending on your OS, the hosts file can be found in a number of locations. Use the table on Wikipedia to track it down.

0

I hope I understand what you meant;

your dyndns service points to your external ip (1.2.3.4 as example), you need to configure Port forwarding on your router.

Maybe your Webserver needs an alias for example.dyndns.org?

6
  • I am not quite getting what you mean here. I have portforwarding enabled/working. From outside, I can see my www.example.com thingi. Point is, I cannot check www.example.com from inside home network. I have to do 192.168.1.4.
    – hari
    Commented May 21, 2012 at 21:58
  • Can you please elaborate on "alias" part?
    – hari
    Commented May 21, 2012 at 22:00
  • Sry I didn't understand the question right. So a work around would be to add C:\Windows\System32\drivers\etc\hosts (on W7) 192.168.1.4 name your want, (localhost, foo.dyndns.org)
    – MemLeak
    Commented May 21, 2012 at 22:04
  • Thanks for the help but I didn't get you. you mean, I should make it point in a way I could call it localhost? why so?
    – hari
    Commented May 21, 2012 at 22:05
  • Maybe a dns resolving problem? Sry
    – MemLeak
    Commented May 21, 2012 at 22:06
0

Its to do with the way port forwarding works differently inside and outside the your network. the router routes correctly from outside the network (WAN) to the selected LAN IP.

I would suggest using a service such as megaproxy in order to test your site from a virtual external location.

Personally i use a NO-NAT connection, which gives me 8x full external internet IP addresses that i can assign to devices, such as web severs and VIOP access boxes. i then have another router running NAT to create an internal network and protect my PC, laptops etc inside the local LAN.

I use ENTA.net for this - very good UK based service, decent price (but a bit more than generic cheap-o home adsl, though not much) and their service is designed for doing this too, so you are well within their usage policies.

0

Alternative Solution:

Out of personal experience, I would choose No-IP to direct your domain to your server.

No-IP's Plus package is something that I have used to eliminate the problem that you are encountering. I read that you are using Dyn's DNS service -- if that cannot be changed, I understand. No-IP's service is much easier for the average person to implement as a www.domain.com to server solution.

If you should use this method, be sure to remove all of your information from the Dyn DNS service to make sure that Dyn DNS is not trying to manage your server and domain at the same time.

You should be able to solve all of your issues using this service. Here is a link: No-IP Plus

Check with your ISP to make sure you are not in violation of your User Agreement and their Terms of Service by self-hosting your domain!

0

Disable remote management in your router settings, or move it to a different port (such as 8080)

0

I am hosting a website on one of my home pc's using a dynamic dns service as well. All I did was:

  1. Forward external requests on port 80 to the pc hosting the site in the router setup. For example (wan ip:80) --> 192.168.1.1:80.

  2. Open port 80 in windows firewall on the server pc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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