Sign inSign up

dev050221/dnsmasq

By dev050221

•Updated almost 4 years ago

Dnsmasq DNS Server on Alpine Linux. Run your own DNS server for your home/small business network.

Image
0

239

dev050221/dnsmasq repository overview

⁠Dnsmasq DNS Server on Alpine Linux

This image allows you to run a DNS server for your home/small-business network. It uses Dnsmasq DNS server built on an Alpine Linux image. The image is very light-weight (only 10 mb in size) and takes as little as 2 mb of memory.

Dnsmasq is copyright (c) Simon Kelley.

⁠How to use the image

⁠Create and run the container
docker run --detach \
--restart=unless-stopped \
--publish 53:53/udp --publish 53:53/tcp \
--env PATH=/bin:/opt/dnsmasq \
--volume $PWD:/etc/dnsmasq.d \
--hostname dnsmasq \
--name dnsmasq \
dnsmasq:latest

On the first run the container creates the dnsmasq.conf file in your present working directory.

⁠Configure Dnsmasq

The default dnsmasq.conf comes with the basic configurations for a DNS server. To quickly set up your DNS server you'll need to change only two parameters:

Search for local= and set it to your local domain, e.g.,

local=/bar/

Next provide all the names your DNS is expected to resolve in the address= parameter. For example:

address=/foo.bar/192.168.1.110
address=/rtfm.bar/192.168.1.120
address=/snafu.bar/192.168.1.130
⁠Run a test on the config file
docker exec dnsmasq dnsmasq --test
⁠Reload dnsmasq with config changes
docker exec dnsmasq restart

You can also read this file with:

docker exec dnsmasq cat /opt/dnsmasq/README.md

Check version of dnsmasq with:

docker exec dnsmasq dnsmasq --version

⁠Troubleshooting on Ubuntu/Fedora

On Ubuntu & Fedora (and possibly other distros) port 53 is taken up by the systemd.resolved service, which prevents any DNS server from starting. This can be fixed as below:

⁠Check which process is using port 53

sudo lsof -i :53

⁠Stop systemd-resolved from using port 53 on Ubuntu

Edit /etc/systemd/resolved.conf

Uncomment DNSStubListener and set it to no.

/etc/systemd/resolved.conf should look like below. If your router is setting the DNS, you can set your DNS IP address in the router and comment out the DNS parameter below. Alternately you can assign your DNS server IP address in DNS.

[Resolve]
DNS=192.168.1.10
#FallbackDNS=
#Domains=
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#DNSOverTLS=no
#Cache=no
DNSStubListener=no
#ReadEtcHosts=yes

Create a symbolic link for /run/systemd/resolve/resolv.conf with /etc/resolv.conf as the destination sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf

Restart Ubuntu/Fedora

⁠Finally

This image is provided "as is" without any assurance of suitability to purpose. Use it, build on it, share it, do whatever suits your fancy.

Tag summary

Content type

Image

Digest

sha256:867c90783…

Size

5.9 MB

Last updated

almost 4 years ago

docker pull dev050221/dnsmasq