DNSMasq
DNSMasq is a lightweight DNS, TFTP and DHCP server. It is intended to provide coupled DNS and DHCP service to a LAN.
- For DNSMasq INIT see: DNSMasq INIT
- See: DHCP and BOOTP Parameters
Documentation
Installing DNSMasq
Note: This Page was written with Fedora in mind, and may not work correctly with other versions or distributions.
Installing DNSMasq using Yum
With Fedora you can just install DNSMasq using yum. Since DNSMasq is designed to be able to run on a smaller router or the like, there are no dependencies needed to install.
yum install dnsmasq
Installing DNSMasq from Source
The below is for version 2.46. You can check for the lates version at DNSMasq Download Site.
wget http://www.thekelleys.org.uk/dnsmasq/dnsmasq-2.59.tar.gz tar -xzf dnsmasq-2.59.tar.gz cd dnsmasq-2.59
Now to compile the downloaded source:
make && make install
DNSMasq INIT Script
#!/bin/sh # # Startup script for the DNS caching server # # chkconfig: - 99 01 # description: This script starts your DNS caching server # processname: dnsmasq # pidfile: /var/run/dnsmasq.pid # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 dnsmasq=/usr/local/sbin/dnsmasq [ -f $dnsmasq ] || exit 0 #DOMAIN_SUFFIX=`dnsdomainname` #if [ ! -z "${DOMAIN_SUFFIX}" ]; then # OPTIONS="-s $DOMAIN_SUFFIX" #fi RETVAL=0 # See how we were called. case "$1" in start) echo -n "Starting dnsmasq: " daemon $dnsmasq $OPTIONS RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dnsmasq ;; stop) if test "x`pidof dnsmasq`" != x; then echo -n "Shutting down dnsmasq: " killproc dnsmasq fi RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dnsmasq /var/run/dnsmasq.pid ;; status) status dnsmasq RETVAL=$? ;; reload) echo -n "Reloading dnsmasq: " killproc dnsmasq -HUP RETVAL=$? echo ;; restart) $0 stop $0 start RETVAL=$? ;; condrestart) if test "x`/sbin/pidof dnsmasq`" != x; then $0 stop $0 start RETVAL=$? fi ;; *) echo "Usage: $0 {start|stop|restart|reload|condrestart|status}" exit 1 esac exit $RETVAL
Configuring DNSMasq
Configuring DNSMasq is pretty strait forward. The main config file (located at /etc/dnsmasq.conf)
domain-needed bogus-priv filterwin2k except-interface=eth0 cache-size=5000 domain=example.com dhcp-range=192.168.1.10,192.168.1.30,60m resolv-file=/etc/dnsmasq-resolv.conf dhcp-host=00:99:00:99:00:99,System1,192.168.1.3 dhcp-host=00:99:00:99:00:98,System2 dhcp-option=option:ntp-server,192.168.1.1 dhcp-option=vendor:MSFT,2,1i address=/system3.example.com/192.168.1.1 # (see SPF for more info) txt-record=example.com,"v=spf1 a ptr:mail.example.com -all"