11

I'm setting up a facility with many different computers where I don't have access to their hosts files. How would I map test.com to a local server without using the hosts file? Can this be done using a simple home router?

I'd like to be able to tell guests: "If you're on our wifi, you can just go to test.com to view our local website."

I'd prefer to keep answers hardware-agnostic, but if it helps, I'm using a D-link DIR-655.

I'm aware of this answer, but I don't think it addresses these issues directly: How can I map a domain name to an IP address and port? (Am I mistaken?)

Thanks!

2 Answers 2

7

I haven't found a home router that can run this without using some custom firmware. However, I use the same server running the sites to host a DNS server internally at home. All the machines point to the DNS server where I have a set of custom directs set up, and all other queries are sent to my ISP's DNS server to resolve correctly. I use DHCP to assign IP's and DNS server addresses to all the clients.

3
  • Thanks -- that confirms my findings. Is this particularly difficult to set up? (I'm running Ubuntu server) Commented Mar 18, 2012 at 21:43
  • There are a bunch of lightweight, simple DNS server softwares out in the world. So, setting up a DNS server can be hard or it can be easy.
    – djangofan
    Commented Mar 18, 2012 at 21:49
  • @lrog If your using Ubuntu Server then look at DNSMasq. It's a DHCP/DNS server roled into one and I have used it successfully in the past, however spent a lot of time searching for the correct config. Commented Mar 19, 2012 at 7:28
4

I would just register the domain for real and point it to a local IP address. For example, if you registered example.com and your local IP address range was 192.168.1.0/24, you could point www.example.com to 192.168.1.184 and run your web server on that IP address. While the name would resolve outside of your network, it wouldn't actually go anywhere.

If you don't want to register a domain for real, instead you can just use your own name servers that make that name resolve however you want. However, I don't recommend this because it could conflict with a real domain.

If you really want to do it by router, use a router than can support Dnsmasq. Any router that can support DD-WRT will do.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .