For some application, it is useful to have a DNS server running locally on your maching. I use
dnsmasq for this. However, ubuntu configures dnsmasq for use on a gateway per default, which is not what I want it for. I want the following things changed:
- dnsmasq should use as upstream DNS server whatever resolvoncf resp. dhclient determine to be my DNS server.
- all my local programs should however ask only dnsmasq to resolve names.
- dnsmasq shall work locally only, not act as a DNS server for others in the network
- dnsmasq shall not act as a DHCP server.
So, here's the setup for /etc/dnsmasq.conf:
# Never forward plain names (without a dot or domain part)
domain-needed
# Never forward addresses in the non-routed address spaces.
bogus-priv
# use the resolv.conf generated by resolvoncf for upstream resolution.
# /etc/resolv.conf will initially be a symlink to that file. we will change that later, see below.
resolv-file=/etc/resolvconf/run/resolv.conf
# try upstream servers strictly in order
# useful if you want to override the upsteam DNS server you get from DHCP in the resolvconf config.
strict-order
# only work locally
interface=loopback
listen-address=127.0.0.1
# NOTE: the bind-interfaces is rejected by dnsmasq on my machione, even though it's present in the example config. odd.
# but the restrictions above should be sufficient anyway.
# bind-interfaces=loopback
# no DHCP (since we only listen to loopback, we only need to exclude loopback)
no-dhcp-interface=loopback
If you have a stupid ISP that uses wildcard A records to grab requests for unknown domains, you can filter them out like this:
# filter bogus A records
bogus-nxdomain=62.157.140.133
bogus-nxdomain=80.156.86.78
If you want to serve SRV records for special services (in this case, Jabber multi user chat):
# The fields are <name>,<target>,<port>,<priority>,<weight>
srv-host=_conference._tcp.dell-daniel,dell-daniel,5267
Then restart dnsmasq:
> sudo /etc/init.d/dnsmasq restart [...
Dnsmasq...]
(no comments yet)