DNS webpage resolve Home Network

Status
Not open for further replies.

Gosefroba

Cadet
Joined
Sep 8, 2012
Messages
1
I have been looking for about an hour and could not find a solution to my problem... partly because I am not sure what I should be looking for

Ok, I have my FreeNas 8.2 box linked to the internet through a webpage "blah.example.com" and I can connect to this page from outside my home network. The problem arises when I try typing that webpage while on my home network then the page will not resolve. I have to type in my local ip

Is there anyway that I can connect to my web page from my local network
 

praecorloth

Contributor
Joined
Jun 2, 2011
Messages
159
Rather than blah.example.com, try just blah. \\blah or http://blah This uses NetBIOS, so you'll want to select Local Master in your CIFS configuration and give FreeNAS some time to work its name around the network. NetBIOS is kinda hit or miss like that.

Alternately you can put an entry in to the hosts file of the machines on your local network.

Code:
192.168.X.X   blah.example.com
or
192.168.X.X   blah


Depending on whether you'd rather use http://blah.example.com or http://blah while you're on your local net.

Alternately alternately if you've got other server machines on your local network, you can fire up DNS for your local network, tie it in with DHCP, and talk to all of your machines via their host name. It's fairly easy to set this up with a Windows server. If you've got a Linux server I recommend dnsmasq.
 

toddos

Contributor
Joined
Aug 18, 2012
Messages
178
I assume you're using port forwarding on your router to expose port 80 from your freenas server? You're probably hitting a NAT loopback problem. Basically, what happens is this:

External:
  1. External browser requests the blah.example.com page
  2. DNS resolves to your WAN IP
  3. Your router sees the request come in from the WAN port and runs it through its firewall rules
  4. One of the firewall rules recognizes that the port requested is 80 and that 80 is forwarded into your network, so forwards the request

Internal:
  1. Internal browser requests the blah.example.com page
  2. DNS resolves to your WAN IP
  3. Your router sees the request go out through its LAN port and recognizes the WAN IP as its own so redirects the request along the LAN side. (Note that this doesn't necessarily mean your router is being smart, but that this is just how NAT works).
  4. The port forward rule is only configured for WAN incoming requests, so it doesn't go through that rule and doesn't get forwarded internally.

At step 3 what your router needs to do is explicitly redirect the request out to the internet and back in through the WAN interface rather than short-circuiting the request. Otherwise the request doesn't come back in through the port forwarding firewall.

This is a good resource for figuring out if your router supports NAT loopback, but I'm not sure how up to date the list is. Alternatively, if you have apache or nginx or another web server that supports reverse proxy configurations running on your router, you can configure reverse proxying instead of port forwarding (I prefer this solution over port forwarding, and it's what I do on my network). Note that this means you pretty much need to either run a custom firmware like ddwrt or tomato or run a full-blown Linux or BSD PC as your router (I do the latter).
 
Status
Not open for further replies.
Top