Differences between revisions 3 and 4
Revision 3 as of 2006-07-12 03:30:00
Size: 2497
Editor: JustinSearle
Comment:
Revision 4 as of 2006-07-12 03:30:46
Size: 2497
Editor: JustinSearle
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
--- Basic DNS Setup --- === Basic DNS Setup ===
Line 23: Line 23:
--- Basic DHCP Setup --- === Basic DHCP Setup ===
Line 53: Line 53:
--- Expanded our DHCP server --- === Expanded our DHCP server ===

Dnsmasq is a lightweight, easy to configure, DNS forwarder and DHCP server. It is designed to provide DNS and optionally, DHCP, to a small network. It can serve the names of local machines which are not in the global DNS. The DHCP server integrates with the DNS server and allows machines with DHCP-allocated addresses to appear in the DNS with names configured either in each host or in a central configuration file. Dnsmasq supports static and dynamic DHCP leases and BOOTP for network booting of diskless machines.

Basic DNS Setup

First things first, lets install the package:

apt-get install dnsmasq

If your goal was to set up a simple DNS server, you just succeeded. To test it, use your favorite DNS lookup tool pointed at localhost.

dig debian.org @localhost

or

nslookup debian.org localhost

By default, DNS is configured to forward all requests to your system's default DNS settings. In case you didn't know, these are stored in the /etc/resolv.conf file. (See ["HowTo/networking"] or type "man resolv.conf" for more details.

Basic DHCP Setup

By default, DHCP is turned off. This is a good thing, as you could brind down whatever network you are connected to if you are not careful.

To enable it, there is at least one line will need to edit in the /etc/dnsmasq.conf file. Around line 143, you will see:

#dhcp-range=192.168.0.50,192.168.0.150,12h

To enable the DHCP server, you will need to give it a range of IP addresses to hand out. In the example above, this server would hand out 101 address starting at 192.168.0.50 and ending at 192.168.0.150. The last number is how long the DHCP leases are good for. In this example, they would be good for twelve hours.

Uncomment the line by removing the # symbol and specifying the values you would like to use. For example, if you want to hand out addresses 10.0.0.10 through 10.0.0.20 for a maximum lease time of four hours, change the line to look like:

dhcp-range=10.0.0.10,10.0.0.20,4h

One more thing you will probably need to do is tell dnsmasq which ethernet interface it can and cannot listen on. Around line 69, you will see:

#interface=

Uncomment the line and specify which ethernet interface you want it server IPs to. For example, if I want it only to server eth1, then it should look like:

interface=eth1

Expanded our DHCP server

#domain=thekelleys.org.uk