DNSMasq
Preparation
- Perform this stage using your functioning PC.
- Download the DNSMasq source code from www.thekelleys.org.uk/dnsmasq/.
- Visit www.thekelleys.org.uk/dnsmasq/ and click on the link for the latest version of DNSMasq. You will need the source code in
.tar.gzformat.- At the time of writing the latest version of DNSMasq was version 1.10, so the file downloaded was
dnsmasq-1.10.tar.gz.
- At the time of writing the latest version of DNSMasq was version 1.10, so the file downloaded was
- You will be asked to where you wish to save the file. Chose a safe place and make a note of it.
- The download is about 51kb and will only take a few seconds to download.
- If you are using a download accelerator program, it will save the file to your default download directory.
- Burn the file
dnsmasq-1.10.tar.gzto a CD. This page assumes that the subdirectory/appsis used for the.tar.gzfile. The CD-ROM can be a multi-session disk.- Use your CD burning software to create an ISO9660 disc image with the file
dnsmasq-1.10.tar.gzin the/appsdirectory. - Burn the CD and verify the data stored on it.
- Use your CD burning software to create an ISO9660 disc image with the file
- Visit www.thekelleys.org.uk/dnsmasq/ and click on the link for the latest version of DNSMasq. You will need the source code in
Booting
- Perform this stage and subsequent stages, unless otherwise stated, using your Core Linux PC.
- Boot your Core Linux PC.
- Login as
root. You will need to enter the password at the prompt.- Wait for the following text to appear:
localhost login: - Type
rootand press Enter. - The screen will display this message:
Password: - Enter the password for
rootthat you set earlier. - You will be shown a prompt that looks like this:
[~]#
- Wait for the following text to appear:
Extract the source
- Place the CD-R in the CD-ROM drive. Mount the CD-ROM drive under
/mnt/cdrom.- At the prompt enter:
mount /dev/hdb /mnt/cdrom - You will see the following line appear:
mount: block device /dev/hdb is write-protected, mounting read-only
- At the prompt enter:
- Change to the
/appsdirectory on the CD-R.- At the prompt enter:
cd /mnt/cdrom/apps - The prompt will change to:
[/mnt/cdrom/apps]#
- At the prompt enter:
- Copy the
dnsmasq-1.10.tar.gzfile to the directory/usr/src.- At the prompt enter:
cp dnsmasq-1.10.tar.gz /usr/src - The system will not display a message if everything is OK.
- At the prompt enter:
- Change to the
/usr/srcdirectory and extract the source from the.tar.gzfile.- At the prompt enter:
cd /usr/src - The prompt will change to:
[/usr/src]# - At the prompt enter:
tar -zxvf dnsmasq-1.10.tar.gz - A long stream of unzipping files and directories should scroll up the screen for a few seconds.
- At the prompt enter:
Configure and compile
- Change to the
/usr/src/dnsmasq-1.10directory.- At the prompt enter:
cd dnsmasq-1.10 - The prompt will change to:
[/usr/src/dnsmasq-1.10]#
- At the prompt enter:
- Run the
makeprogram with the argumentinstall.- At the prompt enter:
make install - A long stream of processes should scroll up the screen for a few seconds.
- The program finishes with the line:
install -m 755 dnsmasq /usr/local/sbin
- At the prompt enter:
Testing
- Configure the upstream DNS servers for your Core Linux system.
- Configuration of network settings for Core Linux was covered here.
- Add the user
nobody.- At the system prompt enter:
useradd nobody - The system will not display a message if everything is OK.
- At the system prompt enter:
- Start the DNSMasq daemon using
/usr/local/sbin/dnsmasq --log-queries.- At the prompt enter:
/usr/local/sbin/dnsmasq --log-queries - The system will not display a message if everything is OK.
- At the prompt enter:
- Set your other computer to use your Core Linux system as its only DNS server.
- How you do this will depend on your operating system and whether you use DHCP on your network.
- Make a DNS lookup from the client computer (e.g. try to open a web page in a web browser using its domain name).
- Check logs on your Core Linux system to ensure that DNSMasq performed the query correctly.
- On your Core Linux system enter:
cat /var/log/syslog | tail - If the query successfully used DNSMasq rather than any other DNS server, you will see information reflecting your lookup:
Jan 12 12:26:50 localhost dnsmasq[114]: reply www.google.com is 216.239.33.101
- On your Core Linux system enter:
Automating DNSMasq
- This section details how to have your DNSMasq server start automatically when the computer boots. The advantage of this method is that you do not have to log in to start DNSMasq. If you wish to start DNSMasq manually after each reboot then skip this section.
- Append the following line to the
/etc/rc.d/rc.muscript:You should adjust the above line to reflect the options with which you want DNSMasq to run. You can also add comments and echoes for your own information./usr/local/sbin/dnsmasq -q- At the prompt enter:
nano /etc/rc.d/rc.mu - The screen will show the contents of
/etc/rc.d/rc.muwith information about the file at the top and bottom of the screen. - Add the following text to the end of the file:
# Start DNSMasq
/usr/local/sbin/dnsmasq -q
echo DNSMasq Started - Save the file and exit the text editor.
- Press Ctrl+x on the keyboard.
- The contents of the white line at the bottom of the screen will change to read:
Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ? - Type
y. - The contents of the white line at the bottom of the screen will change to read:
File Name to write: /etc/rc.d/rc.mu - Press Enter.
- You will be returned to the system prompt.
- At the prompt enter:
- Insert the following line at the second line of the
/etc/rc.d/rc.rbscript:You can also add comments and echoes for your own information.kill `cat /var/run/dnsmasq.pid`- At the prompt enter:
nano /etc/rc.d/rc.rb - The screen will show the contents of
/etc/rc.d/rc.rbwith information about the file at the top and bottom of the screen. - Insert the following text at the second line of the file:
# Stop DNSMasq
kill `cat /var/run/dnsmasq.pid`
echo DNSMasq Stopped - Save the file and exit the text editor.
- Press Ctrl+x on the keyboard.
- The contents of the white line at the bottom of the screen will change to read:
Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ? - Type
y. - The contents of the white line at the bottom of the screen will change to read:
File Name to write: /etc/rc.d/rc.rb - Press Enter.
- You will be returned to the system prompt.
- At the prompt enter:
- Insert the following line at the second line of the
/etc/rc.d/rc.hascript:You can also add comments and echoes for your own information.kill `cat /var/run/dnsmasq.pid`- At the prompt enter:
nano /etc/rc.d/rc.ha - The screen will show the contents of
/etc/rc.d/rc.hawith information about the file at the top and bottom of the screen. - Insert the following text at the second line of the file:
# Stop DNSMasq
kill `cat /var/run/dnsmasq.pid`
echo DNSMasq Stopped - Save the file and exit the text editor.
- Press Ctrl+x on the keyboard.
- The contents of the white line at the bottom of the screen will change to read:
Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ? - Type
y. - The contents of the white line at the bottom of the screen will change to read:
File Name to write: /etc/rc.d/rc.ha - Press Enter.
- You will be returned to the system prompt.
- At the prompt enter:
- Reboot the system and check that DNSMasq is running.
- At the system prompt enter:
shutdown -r now - Wait for the system to reboot.
- As the system reboots, watch for any error messages.
- Once the system has rebooted, try to perform a DNS lookup on your other PC.
- At the system prompt enter:

The text of this page is licensed under a Creative Commons License.
