Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
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 '09 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. –  Martijn Heemels Aug 20 '09 at 9:47
    
All I was saying is that DNS and DHCP are commonly packed together on the same system. –  phuzion Aug 20 '09 at 11:33

6 Answers 6

up vote 5 down vote accepted

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.

share|improve this answer
    
It might not be the router running the DHCP, so if it's not, change whatever is running your DHCP. –  Mark Henderson Aug 20 '09 at 2:06

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

share|improve this answer

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

share|improve this answer

Hi 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.

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.