Can I easily configure a domain name that works locally and remotely.
January 20, 2014 1:56 PM   Subscribe

I'm in the process of setting up a home server that I would like to be able to address by the same domain name ( ) both from the outside world and from within my home network. Is there an easy way to do this?

I'm in the process of setting up a home server that I would like to be able to address by the same domain name ( ) both from the outside world and from within my home network.

To do the first part, I would buy the domain name, direct it to my router, and NAT the address to my server. I can use a dynamic dns provider to quickly and automatically redirect the domain name if my home ip address changes. I've done this before.

The second part is where I run into problems.

If I try to use the same ip address to get to the server from inside my home network, I run into NAT related problems. I believe this happens because outgoing packets from the server don't get NAT'ed back to the local client properly. (Even if this did work, it would be a long path for a packet to take to get from one machine to another that are on the same local network - but that's beside the point ).

I can locally set the ip address for the server on a per client basis but that's (1) a lot of busy work (2) probably going to cause problems when I want to access the network locally and remotely from the same machine - maybe a laptop and (3) something I don't even know how to do in all cases - a phone for example.

I can configure my own local name server to direct my domain name to the local ip address and direct local queries to that server. That's probably also going to have problems if I move a machine from local to remote. Also it seems like a overly complicated hack.

What I'm hoping for is an easy way to do this. It seems like a problem that must come up for a lot of people.

The clients could be windows machines, linux machines, or android phones.

Thanks for reading and for any responses.
posted by metadave to Technology (5 answers total) 1 user marked this as a favorite
You could always setup a sub-domain in the DNS record that points to your internal IP. It wouldn't work outside the firewall, but it should be fine inside.
posted by blue_beetle at 2:06 PM on January 20, 2014

Whatever the IP is on your local network, add the name and that IP to the "hosts" file in all the other machines on your LAN.

On Windows the file is C:\Windows\System32\drivers\etc\hosts
On Linux it's /etc/hosts

The machine looks there first to resolve the name before it tries to access any DNS.
posted by Chocolate Pickle at 2:09 PM on January 20, 2014 [1 favorite]

Best answer: The feature your router needs to support is called NAT loopback, and this is supposedly a list of routers that support it:
posted by jjwiseman at 2:12 PM on January 20, 2014 [3 favorites]

Response by poster: Thanks, jjwiseman.

NAT loopback looks exactly like what I'm looking for. My router does not support it but it looks there is a version of dd-wrt available for my router that does support it.

- Dave
posted by metadave at 2:47 PM on January 20, 2014

Response by poster: epilogue:

After installing dd-wrt on my router, applying the appropriate NAT rules, and following these directions to enable NAT loopback on dd-wrt, I'm getting the results I wanted ( and described in the original question ).
posted by metadave at 11:29 PM on January 21, 2014 [2 favorites]

« Older Where should I live in San Diego?   |   Question about violent language used by a 6 y/o... Newer »
This thread is closed to new comments.