This may sound like a very silly question, but how could I setup domains ( eg www.foo.com ) on my local network? I know that all a domain is, is just a name registered to a name server and that nameserver has a zone record, and in the zone record there are several records of which the A Record is the most important in dictating where the lookup goes to, which machine it should point to.

I basically want to make it so that I can refer to my other computer/webserver as 'www.foo.com' and make my local sites accessible by that, mess with virtualhost records in Apache and zone records for the domain except locally so I can explore and fiddle around and learn instead of having to rely on the domains I own on a public registrar that I could only access through the internet.

Once again I apologize if this is a silly question, or if I'm completely thinking backwards.

Background information: My OS is Debian, I'm a novice at Linux. I've done very small edits in zone records on a Bind9 Server but that's the extent of my networking experience.

2 Answers 2


I'd agree with Womble's answer for most cases. Your comment to his answer, though, mentions simulating mail delivery for that domain. Entries in the "HOSTS" file act the same way as "A" records in DNS. If you need to "simulate" MX, SRV, or other types of records, though, you are going to have to setup a DNS server.

You can create zones for the domains you want to "simulate" in your BIND server. All the computers that use your DNS server will resolve the names in whatever domains you choose to make your server authoritative for however you configure them. Heh heh...

I quite like having an internal DNS server on the LAN. I enjoy creating zones for domains like "doubleclick.net" and putting in wildcard records that refer to an IP address of a web server on the LAN to return 404 errors in place of their ads.

  • You mind pointing out useful references for getting my network to use the Bind server? Oct 23, 2009 at 19:24
  • You need to have the hosts on your use your Bind installation as their DNS server. How are you assigning DNS servers to hosts on your network now? If you're using DHCP to assign IPs to your hosts the DHCP server is probably handing out IP addresses for DNS servers. If you're using some embedded router device as a DHCP server you may be able to override the setting it hands out to clients. If not, you're stuck either using a different DHCP server or specifying the DNS server on each host. Oct 23, 2009 at 20:29
  • Yeah I have a Linksys router and it's setup to do auto DHCP. I'll try to google up and see if there are any guides. Oct 24, 2009 at 0:48

I think what you want to do is edit your local machine's hosts file (/etc/hosts on most Unices, something under windows32 or whatever on Windows boxes) to point www.foo.com or whatever to your local machine or any other local IP address you want to use.

  • I'm aware of the hosts file but how would I say, setup a local mailserver on that "domain", shouldn't I need to setup a NS server like Bind9 locally? Oct 23, 2009 at 3:58
  • If you need to do MX records or anything, then yes, you'll need a Real DNS Server. I like tinydns, myself.
    – womble
    Oct 23, 2009 at 4:23
  • So would that be the hosts file combined with something like Bind9? Oct 23, 2009 at 4:45
  • Well, I use dnscache as a local resolver cache, so what I do is just tell dnscache to send all requests for foo.com to my local tinydns instance, which I've configured to send whatever results I want, so I don't use /etc/hosts much.
    – womble
    Oct 23, 2009 at 4:55

You must log in to answer this question.

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