3

I'm familiar with the trick of of editing the /etc/hosts file to direct your computer's traffic to specific IP addresses. Now, I'm looking for a LAN-wide solution. Of course, I could edit all of the computers' /etc/hosts files (manually or automatically), but that's not ideal.

An ideal solution would involve a machine running a DNS server, and the router recognizing that as the server that takes precedence over anything that internet-wide DNS servers may offer. Or, perhaps, the router could act as the DNS server (after all, it knows how to convert computer names to IP addresses as part of DHCP). I'd prefer not to need to change any settings on the computers on the network.

Any suggestions? I'd hope this would be pretty easy.

3
  • 1
    Which OS are you planning on using for the DNS server? Just about every OS has suitable DNS and DHCP servers available for them.
    – phuzion
    Aug 20, 2009 at 1:54
  • 1
    Knowing how to convert computer names to IP addresses is not part of DHCP. It's an easy mistake to make. Your router's DHCP server advertises a bunch of settings, one of which is which DNS server clients should use. Your router is likely configured to advertise itself for DNS, and runs a small caching DNS server in its firmware. So although DHCP and DNS both run on the router they are separate services and can be split to separate machines. Aug 20, 2009 at 9:47
  • All I was saying is that DNS and DHCP are commonly packed together on the same system.
    – phuzion
    Aug 20, 2009 at 11:33

6 Answers 6

8

Setup DNS on a machine, and tell the router to hand out that IP address as the DNS server as part of the DHCP config. If your router doesn't support this, then perhaps consider something a little less arse.

1
  • It might not be the router running the DHCP, so if it's not, change whatever is running your DHCP. Aug 20, 2009 at 2:06
2

It could be my misreading of the question, but it sounds like you're trying to give out a specific address for one or two specific domains, instead of providing full external DNS lookup/caching capability to a group of hosts on your LAN. If this is the case, you accomplish this by setting up an internal-only bind server, and configure it to serve up the domains you're trying to modify as zones.

For instance, if foocorp.com generally returns an external address of 4.2.2.2 to the rest of the outside world, but for the hosts on your lan you want it to return 192.168.0.95, tell your internal-only BIND server that it owns the zone 'foocorp.com' and give it a zonefile that defines an A-record for www.foocorp.com as 192.168.0.95. When your LAN hosts query 'foocorp.com', your internal BIND server won't even bother doing an external lookup. It will just say "Ah hah, I have a zonefile for foocorp.com right here, I'm going to return data from it" instead.

HTH,

--Lee

1

dnsmasq should suit all your needs. It can act as a DNS server, taking entries from your hosts file. In addition, it can be configured as a DHCP server, so all other machines on the LAN will pick up their addresses, gateway address, and the address of your local DNS server, automatically

0

you can setup Bind on a dedicated server.(http://www.bind9.net/) Then on the router (or firewall) which acts as DHCP + DNS server you tell that the router should use your DNS Server as primary one. When people will renew thier adress, they'll have your DNS server as the primary one. The Primary / secondary difference is important : When a user asks for a domain name that the primary server won't be able to respond, the second one will be asked. If you create custom hosts on the dns server, people will ask for it and it will work.

0

Essentially I would just repeat what Womble has already said. I would add however that it would be in your best interests to do some reading and get to understand DNS, DHCP and the hosts file. They are so fundamental a part of networking that you will run into trouble if you don't understand them.

0

If you are using a consumer grade router, i'd suggest looking into DDWRT for it, since ddwrt is a linux OS it shouldn't be to hard to setup a bind server on it, or a djbdns, but that is a pain to get setup if you don't know EXACTLY what you are doing.

Another note, dns servers tend to be security risks, even internal one, due to configuration as well as vulnerabilities. A solution might be to run a light os (knoppix or cut down centOS) that is PROPERLY configured in a VM on a system, so that if it does get hit, you can easily snapshot it back to where it was, this also means you don't need a "dedicated" machine, but can effectively have one.

You must log in to answer this question.

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