Setting up subdomains for a LAN?
January 26, 2008 7:37 AM   Subscribe

How do I give my computers subdomain names on my local network? For example, mylaptop.mynetwork.com, mydesktop.mynetwork.com, momslaptop.mynetwork.com, kids.mynetwork.com and so on? Do I have to set up some kind of local DNS or is there an easier way to do it in the router? I am not concerned at this point about being able to access the subdomains from the WAN although that would be handy later. It's the LAN I'm interested in. (Obviously I am using Bonjour right now but for I want to use the subdomains too). I own mynetwork.com and it points to a static IP. My LAN router is firewalled behind that. It's a WRT54G running DD-WRT. I have a spare computer I could run DNS on but I'd rather not have to do that. Everything is Macs running OS X, mostly Leopard.
posted by unSane to Computers & Internet (9 answers total) 8 users marked this as a favorite
 
I believe you ought to be able to make sure the router always hands out the same ip address to the hosts, and then add entries to the hosts file on each of your machines on the lan.
posted by mzurer at 7:53 AM on January 26, 2008


Yeah, I was going to say host file as well. You're not going to want to do that on a large network, but with a few machines, it should be easy. That's how people configured networks back before DNS! (IIRC)
posted by delmoi at 8:01 AM on January 26, 2008


Again, hosts file, OR you could get an account on OpenDNS. Use them as your main DNS entries in the router and you can also configure internal network names - check out 'Shortcuts'. That's only usable when you're doing DNS lookups from the IP that you've identified with OpenDNS is sitting on, but it's a start. You'd have to go with static IPs or static DHCP entries internally either way.
posted by Dipsomaniac at 9:20 AM on January 26, 2008


"With OpenDNS is sitting on"? I don't know where that came from.

Try "from the IP you've identified with OpenDNS."
posted by Dipsomaniac at 9:22 AM on January 26, 2008


Best answer: Since you're running DD-WRT, you already have everything you need. Just go to Administration, Services, and enter static leases with hostnames, and it'll do the DNS for you. Even if you're configuring the machines individually with fixed IPs rather than DHCP, it'll still do it if you have Local DNS turned on under DNSMasq.
posted by George_Spiggott at 10:12 AM on January 26, 2008 [1 favorite]


Best answer: I should add that "Static Leases" is under "DHCP Server" on that page. Just create entries for each of your computers in there, this puts them into the WRT's host table makes them known to its built-in DNS server. Since you indicate you want to optionally use a domain name, enter that in the "LAN Domain". You won't need the domain name when doing local lookups, the hostname will be sufficient, but you'll be able to do lookups using the domain name as well if you want to.

Voila, instant home DNS. Do NOT bother with hosts files on the individual machines, keeping them all sync'd up is a pointless chore.
posted by George_Spiggott at 10:29 AM on January 26, 2008


Best answer: Oh, and of course you need to configure your machines to use the WRT as a DNS server, obviously, and make sure your the WRT knows what your public DNS server's IP is. DNSMasq will forward public DNS and take care of the private DNS itself.
posted by George_Spiggott at 10:31 AM on January 26, 2008


It occurs to me that you could have your DNS host make A records for your subdomains pointing to nonroutable addresses, ie 192.168.1.0 range for example.

It would only work inside your LAN but as far as I know it would work.

So, yourdomain.com A record points to the static IP address on your router's WAN port.
Subdomain.yourdomain.com A record points to 192.168.1.2
Subdomain2.yourdomain.com A record points to 192.168.1.3
and so forth.

I don't know if an ISP would be willing to make this kind of nonroutable IP entry on a domain, but they might. It wouldn't mean anything from their standpoint, wouldn't cause weird traffic for example.

So, from inside, as long as you are using your DNS host for domain queries, subdomains with an A record that map to internal LAN addresses would resolve properly. In fact, domain queries on these subdomains would be authoritative so it wouldn't matter where the resolution was occurring.

Some ISP's allow you to make your own entries on a host record. I use dyndns.org for example. This site also will let you assign one of their subdomains to the IP of your choosing. That's a free service. You could test the above by using one of their free subdomain mappings to see if it works.

My two cents worth. Your mileage may vary.
posted by D-ten at 12:14 PM on January 26, 2008


I don't know if an ISP would be willing to make this kind of nonroutable IP entry on a domain, but they might. It wouldn't mean anything from their standpoint, wouldn't cause weird traffic for example.

Yes, ISPs will do this. Also free DNS services like dyndns or zoneedit etc.

But the in-the-router solutions are cleaner, I think.
posted by rokusan at 1:42 PM on January 26, 2008


« Older Where should I eat while doing jury duty in...   |   Portland OR Filter: Suggest a local events... Newer »
This thread is closed to new comments.