DHCP Server: DNSMasq: Difference between revisions

From SlackWiki
Jump to navigation Jump to search
(CREATED!)
 
(FIXED: typo)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
Written from a Slackware 13.37 perspective.
Written from a Slackware 13.37 perspective.


To set up a DHCP server you can use the dchp package that is included with Slackware OR you can do it the easier way and use DNSMasq (also included with Slackware).
To set up a DHCP server you can use the dchp package (that is included with Slackware)<br>
'''or'''<br>
you can do it the easier way and use DNSMasq (also included with Slackware).


'''Assuming that you do not have DNSMasq installed'''
'''Assuming that you do not have DNSMasq installed'''


1) Install the official dnsmasq Slackware package either by pkgtool oe slackpkg.
1) Install the official dnsmasq Slackware package either by pkgtool or slackpkg.


2) Make DNSMasq start on boot:
2) Make DNSMasq start on boot:
Line 19: Line 21:


     CHANGE: #dhcp-range=192.168.0.50,192.168.0.150,255.255.255.0,12h
     CHANGE: #dhcp-range=192.168.0.50,192.168.0.150,255.255.255.0,12h
     TO: dhcp-range=192.168.1.200,192.168.1.239,12h  (using your correct IP range)
     TO: dhcp-range=1ST_POOL_IP,LAST_POOL_IP,12h  (using your correct IP range)
 
1a) If your DNSMasq box isn't also your gateway router, tell your DHCP clients who is the default gateway:
 
    CHANGE: #dhcp-option=3,1.2.3.4
    TO: dhcp-option=3,YOUR_GATEWAY_IP


2) start/restart DNSMasq
2) start/restart DNSMasq
Line 35: Line 42:


'''NOTE:''' The IP address should be OUTSIDE the DHCP pool.
'''NOTE:''' The IP address should be OUTSIDE the DHCP pool.
[[Category: Tutorials]]

Latest revision as of 16:18, 29 August 2012

Written from a Slackware 13.37 perspective.

To set up a DHCP server you can use the dchp package (that is included with Slackware)
or
you can do it the easier way and use DNSMasq (also included with Slackware).

Assuming that you do not have DNSMasq installed

1) Install the official dnsmasq Slackware package either by pkgtool or slackpkg.

2) Make DNSMasq start on boot:

    CHMOD 755 /etc/rc.d/rc.dnsmasq


At this point you will have a really cool little DNS on your box...

If you already had DNSMasq running on your box, start here

1) edit the /etc/dnsmasq.conf file:

    CHANGE: #dhcp-range=192.168.0.50,192.168.0.150,255.255.255.0,12h
    TO: dhcp-range=1ST_POOL_IP,LAST_POOL_IP,12h  (using your correct IP range)

1a) If your DNSMasq box isn't also your gateway router, tell your DHCP clients who is the default gateway:

    CHANGE: #dhcp-option=3,1.2.3.4
    TO: dhcp-option=3,YOUR_GATEWAY_IP

2) start/restart DNSMasq

    /etc/rc.d/rc.dnsmasq restart

You should now have a working DCHP server.


Persistent IPs

To assign IPs based on a device's MAC address, edit /etc/dnsmasq.conf and add the following line for every device (using the correct MAC and IP of course):

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

NOTE: The IP address should be OUTSIDE the DHCP pool.