DNSMasq as DHCP server

From DD-WRT Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 10:54, 16 January 2007 (edit)
Cyberde (Talk | contribs)
(Introduction)
← Previous diff
Revision as of 02:44, 15 February 2007 (edit) (undo)
Whiteboy (Talk | contribs)

Next diff →
Line 1: Line 1:
-__TOC__ 
- 
-=Introduction= 
DD-WRT supports using [http://www.linux.org/apps/AppId_6060.html DNSMasq] "as local DNS server" and also uses the DHCP service [http://udhcp.busybox.net/ "udhcpd"]. This is a waste of RAM (router has 16MB total and only 3MB free). DD-WRT supports using [http://www.linux.org/apps/AppId_6060.html DNSMasq] "as local DNS server" and also uses the DHCP service [http://udhcp.busybox.net/ "udhcpd"]. This is a waste of RAM (router has 16MB total and only 3MB free).
With DNSMasq as the sole DHCP server you can save 300kB (udhcpd deactivated!). With this savings you can create one more PPTP tunnel with the inserted PPTPD server. With DNSMasq as the sole DHCP server you can save 300kB (udhcpd deactivated!). With this savings you can create one more PPTP tunnel with the inserted PPTPD server.
Line 10: Line 7:
'''You can NOT use both''' '''You can NOT use both'''
-=Setting it up=+=Configuration=
- +
==Using Web-Admin== ==Using Web-Admin==
This is the easiest way to setup DNSMasq as DHCP Server This is the easiest way to setup DNSMasq as DHCP Server
Line 22: Line 18:
***'''DHCP Server''' = enabled ***'''DHCP Server''' = enabled
***'''Use DNSMasq for DHCP''' = checked ***'''Use DNSMasq for DHCP''' = checked
- 
[[Image:Setup_basic_dhcp.jpg]] [[Image:Setup_basic_dhcp.jpg]]
- 
*Go to Administration->Services *Go to Administration->Services
Line 31: Line 25:
***'''DHCP Daemon''' = enabled ***'''DHCP Daemon''' = enabled
*You can add static allocations the same way when you're using DHCPd *You can add static allocations the same way when you're using DHCPd
- 
[[Image:Administration_services_dhcpd.jpg]] [[Image:Administration_services_dhcpd.jpg]]
-==Using DNSMasq parameters==+==DNSMasq parameters==
- +
This provides access to more functionality at the expense of not being able to use the structured web interface. This provides access to more functionality at the expense of not being able to use the structured web interface.
Line 56: Line 48:
If it's not possible to assign an IP with DNSMasq and you want to identify devices via name resolution, you must add the following lines: If it's not possible to assign an IP with DNSMasq and you want to identify devices via name resolution, you must add the following lines:
- 
no-hosts no-hosts
addn-hosts=/tmp/hosts addn-hosts=/tmp/hosts
Line 62: Line 53:
You must also add this computer to /tmp/hosts: You must also add this computer to /tmp/hosts:
192.168.0.5 printers drucker.lan 192.168.0.5 printers drucker.lan
- 
- 
-Original Thread: http://blog.ptch.de/index.php?/archives/33-WRT54G-DNSMasq-als-DHCPD.html (German) 
=Extra DNSMasq options= =Extra DNSMasq options=
Line 86: Line 74:
11:22:33:44:55:66 = MAC address of the machine you wish to ignore</pre> 11:22:33:44:55:66 = MAC address of the machine you wish to ignore</pre>
- 
-For more options take a look at http://www.faqs.org/rfcs/rfc2132.html 
==Disable NetBIOS over TCP/IP== ==Disable NetBIOS over TCP/IP==
Line 93: Line 79:
<pre> <pre>
dhcp-option=43,01:04:00:00:00:02</pre> dhcp-option=43,01:04:00:00:00:02</pre>
 +
 +=External Links=
 +http://www.faqs.org/rfcs/rfc2132.html Options on MAC addresses
 +
 +=References=
 +http://blog.ptch.de/index.php?/archives/33-WRT54G-DNSMasq-als-DHCPD.html

Revision as of 02:44, 15 February 2007

DD-WRT supports using DNSMasq "as local DNS server" and also uses the DHCP service "udhcpd". This is a waste of RAM (router has 16MB total and only 3MB free). With DNSMasq as the sole DHCP server you can save 300kB (udhcpd deactivated!). With this savings you can create one more PPTP tunnel with the inserted PPTPD server.

There are two ways to accomplish this

  • Using the Web-Interface (for beginners who want to use the default options)
  • Using DNSMasq parameters (for advanced users who can understand dnsmasq.conf file layout, and know where to find the manual page for it)

You can NOT use both

Contents

Configuration

Using Web-Admin

This is the easiest way to setup DNSMasq as DHCP Server


  • Go to your Web-Interface and log in
  • Go to Setup->Basic Setup
    • Make sure that
      • DHCP Type = DHCP Server
      • DHCP Server = enabled
      • Use DNSMasq for DHCP = checked

Image:Setup_basic_dhcp.jpg

  • Go to Administration->Services
    • Make sure that
      • DHCP Daemon = enabled
  • You can add static allocations the same way when you're using DHCPd

Image:Administration_services_dhcpd.jpg

DNSMasq parameters

This provides access to more functionality at the expense of not being able to use the structured web interface.

Following steps are necessary:

  • Deactivate the DHCPD service on the "Setup" page.
  • Under the "Administration" tab in the "Services" sub tab, you will find a "DNSMasq" section. Enable "DNSMasq", and "Local DNS", then under "Additional DNS Options", you need to set some parameters.
 * To setup the default options for Dynamic IP Allocation, add:
   dhcp-range=192.168.1.100,192.168.1.150,255.255.255.0,24h 
 * To setup machines to have a Static IP assigned by the router, add either:
   dhcp-host=AB:CD:EF:11:22:33,192.168.1.10,24h
   or
   dhcp-host=computername,192.168.1.10,24h

AB:CD:EF:11:22:33 is the MAC of the network, computername is the NetBIOS name of the computer on the network, 192.168.1.10 indicates the desired IP, and finally 24h the DHCP lease of 24 hours, however if you wish to have the lease for the machine never expire, you may do so by changing 24h to infinite.

If it's not possible to assign an IP with DNSMasq and you want to identify devices via name resolution, you must add the following lines:

no-hosts
addn-hosts=/tmp/hosts 

You must also add this computer to /tmp/hosts:

192.168.0.5 printers drucker.lan 

Extra DNSMasq options

There are some extra options you can set by entering them in Additional DNS Options

If you are using the Web-Admin method then you can enter additional options in the Administration/Management tab under Additional DHCPD Options

ISP DNS-Servers

If you wish to pass through the DNS servers from your ISP, you can use the following parameters:

dhcp-option=6,x.x.x.x,y.y.y.y

x.x.x.x = DNS1
y.y.y.y = DNS2


Denying DHCP service to specific MAC addresses

You can ignore requests from specific MAC addresses, so that no IP address will be leased to those specific MAC addresses/machines

dhcp-host=11:22:33:44:55:66,ignore

11:22:33:44:55:66 = MAC address of the machine you wish to ignore

Disable NetBIOS over TCP/IP

Since DNSMasq acting as a local DNS server suitably takes care of host name resolution, disabling NetBT on appropriately configured Microsoft DHCP clients, such as Windows 2000 and XP, can be accomplished with the following:

dhcp-option=43,01:04:00:00:00:02

External Links

http://www.faqs.org/rfcs/rfc2132.html Options on MAC addresses

References

http://blog.ptch.de/index.php?/archives/33-WRT54G-DNSMasq-als-DHCPD.html