[Dnsmasq-discuss] Setting up dnsmasq on an [x]ubuntu machine - what's the 'right' way to do it?

Chris Green cl at isbd.net
Sat May 10 16:07:19 UTC 2014


On Sat, May 10, 2014 at 12:07:59PM +0100, Chris Green wrote:
> I've been using dnsmasq for quite a while on a small server machine on
> my home network but that machine is now redundant really and I'd like
> to save the electricity it's using.
> 
> So I'm going to move dnsmasq to my desktop machine (which is also a
> server and is powered up all the time).  My desktop machine runs
> xubuntu 14.04 so has the default resolvconf setup where the resolver
> runs a cut-down dnsmasq and /etc/resolv.conv just points to 127.0.0.1.
> 
> What's the 'right' way to install a full dnsmasq onto my system and
> make it use /etc/dnsmasq.conf for configuration etc.?  I know I had a
> fairly hard time sorting it out on the system where it is now and I
> want to make the process as painless as possible! :-)
> 
Well I decided I could probably muddle through and I seem to have
managed it fairly OK, I have attached my summary of how to do it (as a
Dokuwiki text file, easy enough to read).  Would it be useful to add
this to the FAQ, it's an issue that comes up quite a lot in various
forums.

It's not for the faint-hearted though, I'll make some comments here.


> Obviously I need to give my machine a static IP on my Lan, that's easy
> enough.
> 
Yes, no need to set the DNS server(s) here, I don't think.


> At present there is dnsmasq-base installed (used by resolvconf), if I
> just install the dnsmasq package will it do the necessary so that 
> it uses /etc/dnsmasq.conf etc.?
> 
Yes, but you need to disable the NetworkManager dnsmasq by editing
/etc/NetworkManager/NetworkManager.conf to remove the dns=dnsmasq.


> Where do I specify the upstream DNS servers that dnsmasq should use?
> 
In one or more files in /etc/NetworkManager/system-connections.


> Can I get dnsmasq to hand out a secondary/backup DNS server to DHCP
> clients so that if/when my desktop machine is turned off for upgrades
> or reboots it doesn't totally disable the other machines on the LAN?
> 
I still want an answer to this one please.

-- 
Chris Green
-------------- next part --------------
======dnsmasq======

To use a 'proper' dnsmasq instead of the dnsmasq-base package that provides local DNS
and is run by NetworkManager the following steps are needed:-

==1 - Install the dnsmasq package==
The dnsmasq-base package will already be installed bur you can't remove it because
it's a dependency of NetworkManager, just leave it.

==2 - Change to a static IP==
The simplest way to do this is simply to do it by clicking on the NetworkManager
applet and set the IPV4 addressing to 'manual'.  I don't think there's any need
to set the DNS server IP here.

==3 - Edit the Network Manager configuration==

In directory /etc/NetworkManager/system-connections there will be a file 'Wired connection 1',
edit the dns line in this file to point to localhost plus real DNS servers:-

    dns=127.0.0.1;212.159.6.9;212.159.13.49;

There may be more files in the same directory for WiFi connections, edit them in
the same way (though I'm not sure that a DNS server connected by WiFi is a good
idea).


Edit the file /etc/NetworkManager/NetworkManager.conf, comment out the line dns=dnsmasq
(or if you're feeling daring, delete it).

==4 - Set options as required in /etc/dnsmasq.conf==

In particular DHCP isn't enabled in the supplied default configuration so at
the very least you need to un-comment the dhcp-range line and check that it
is correct for the LAN.


More information about the Dnsmasq-discuss mailing list