0

DNSMASQ – home network changes

Desided to make some changes to the home network using dnsmasq. dnsmasq is a light weight dns cache/dhcp/tftp server that is easy to configure and manage and does not require a large footprint as far as memory or cpu.

In my home network I have a main router which acted as a wireless access point and dhcp server which plugs into my MOCA network and to the gigE switch for the wired machines. I have another wireless AP on the MOCA network to extend my wireless footprint.

dnsmasq pretty much works right out of the box however I wanted to add some specific settings.

DNS cache - with some ad blocking
used the services from yoyo.org to create a block list of sites in dnsmasq format and update it weekly onto /etc/dnsmasq.d with a simple cronjob.

wget -O /etc/dnsmasq.d/ad-block-list "http://pgl.yoyo.org/adservers/serverlist.php?hostformat=dnsmasq&showintro=0&startdate%5Bday%5D=&startdate%5Bmonth%5D=&startdat
e%5Byear%5D=&mimetype=plaintext"

this will help to block spam/ad sites and ads from appearing in various sites and also stop most popups.

DHCP Server
dnsmasq allows you to bundle DHCP server with the same daemon. so i've moved the DHCP server from the main router to this server and set my router to DHCP relay. DHCP server within dnsmasq is actually pretty robust and feature rich and the following was the config i've used

expand-hosts
domain=sullung.com
dhcp-range=192.168.1.150,192.168.1.200,255.255.255.0,12h
dhcp-option=3,192.168.1.1
dhcp-option=42,0.0.0.0
dhcp-option=6,192.168.1.29,209.18.47.61
dhcp-leasefile=/var/lib/dnsmasq/dnsmasq.leases

you can also set static IP's via DHCP by using the following :
dhcp-host=MAC,HOSTNAME,IP,DURATION

Lastly you can add dns entries for your non routable servers using :
address=/domain/IP

the config lines are pretty self explanatory but if you want more details you can always view the man pages.

jlim0930

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.