1

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.

Zoredache
  • 128,755
  • 40
  • 271
  • 413
meder omuraliev
  • 1,701
  • 3
  • 20
  • 30

2 Answers2

2

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.

womble
  • 95,029
  • 29
  • 173
  • 228
  • 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? – meder omuraliev Oct 23 '09 at 03: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 '09 at 04:23
  • So would that be the hosts file combined with something like Bind9? – meder omuraliev Oct 23 '09 at 04: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 '09 at 04:55
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.

Evan Anderson
  • 141,071
  • 19
  • 191
  • 328
  • You mind pointing out useful references for getting my network to use the Bind server? – meder omuraliev Oct 23 '09 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. – Evan Anderson Oct 23 '09 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. – meder omuraliev Oct 24 '09 at 00:48