Daniel's Blog
24 Okt/11 0

HOWTO: Quick and dirty DHCP server and DNS cache with dnsmasq on Ubuntu

DHCP on the LAN is practical. You no longer manage the network configuration of each computer in the network to the clients themselves, but everything has a lovely central location server. Save by caching DNS clients a little time must be made when resolving host names, since the queries can be applied to well-known host names from the local cache rather than to a server on the Internet.

A small DHCP server is set up dnsmasq with very quickly.

 # Install dnsmasq
 apt-get install dnsmasq

The configuration takes place centrally in the file / etc / dnsmasq.conf. One should not leave before the clenched configuration options in file deterred. Just about everything is just an example and is by default commented out. A very short Config is already sufficient for a working setup:

DHCP

 # DHCP netmask
 # Clients received 255.255.255.0 as netmask
 dhcp-option = 1,255.255.255.0

 # Default gateway
 # Clients received as a gateway 192.168.1.251
 dhcp-option = 3,192.168.1.251

 # Dns
 # Clients get the name server 192.168.1.4
 # If you want to use dnsmasq as DNS cache, this should be the
 Be # IP of the server that is running the dnsmasq
 dhcp-option = 6,192.168.1.4

 # Hosts for the same IP address assigned by the MAC:
 # This gets the host with the MAC 00:11:22:33:44:55 IP 192,168.1.1 for 12 hours

 dhcp-host = 00:11:22:33:44:55, lobby, 192.168.1.1,12 h
 dhcp-host = 00:11:22:33:44:66, Lobby2, 192.168.1.2,12 h

 # All the computers that can not be identified by MAC receive IPs
 # From the pool of 192.168.1.120 to 150

 dhcp-range = 192.168.1.120,192.168.1.150,12 h

DNS

The DNS functionality of dnsmasq needs no configuration.
dnsmasq is concerned its nameservers from / etc / resolv.conf. This should be
known name server of the provider are recorded and possibly even as a fallback
8.8.8.8 for the Google's DNS servers.

For more hostnames that should apply in the local network can, dnsmasq in the file
Be / etc / hosts made known. Here are all the computers registered hostnames
the LAN.

Pitfalls

dnsmasq needs to reread its configuration files Konfigänderungen

 / Etc / init.d / dnsmasq restart

If clients do not have a lease from the old DHCP server, you can manually bring it to start a new DHCP request.

 # Linux
 dhclient eth0

 # Windows
 ipconfig / RELEASE
 ipconfig / RENEW

Urgently have to be careful, so far for use anywhere DHCP server (usually the router to the Internet) to disable. 2 DHCP servers on the LAN can generate a lot of chaos.

Comments (0) Trackbacks (1)

    Leave a comment

    * Copy this password:

    * Type or paste password here:

    399 Spam Comments Blocked so far by Spam Free Wordpress

    Please copy the string to the field below tfJeUA: