Sign inSign up

shepner/dnsmasq

By shepner

•Updated about 6 years ago

Image
0

749

shepner/dnsmasq repository overview

⁠Docker-DNSmasq⁠

Uses Alpine Linux⁠, DNSmasq⁠, and has webproc⁠ to previde a web interface. New builds (should) occur whenever Alpine or this github repo is updated

⁠Instructions

This setup is a bit more difficult then others mainly to provide more flexability. It can be make considerably simpler if you dont mind reducing your options.

NOTE: Before you do anything, you must disable any DNS server running on the local host or this will fail. Ubuntu Server 18.04, for some dumb reason, has one (I think DNSmasq) running by default which is listening on all interfaces.

NOTE: In all cases, you will have to do a great deal of configuration here to have anything more then a basic DNS resolver

⁠run as just a DNS server in a docker swarm

Point your DNS clients to an assortment of the physical host addresses. All in the swarm will work equally well.

mkdir -p /mnt/nas/docker/dnsmasq/config
mkdir -p /mnt/nas/docker/dnsmasq/webproc

wget -O /mnt/nas/docker/dnsmasq/program.toml https://raw.githubusercontent.com/shepner/Docker-DNSmasq/master/program.toml
wget -O /mnt/nas/docker/dnsmasq/config/dnsmasq.conf https://raw.githubusercontent.com/shepner/Docker-DNSmasq/master/dnsmasq.conf
wget -O /mnt/nas/docker/dnsmasq/resolv.conf https://raw.githubusercontent.com/shepner/Docker-DNSmasq/master/resolv.conf

sudo docker service create \
  --name DNSmasq-dns \
  --publish published=53,target=53,protocol=udp,mode=ingress \
  --publish published=53,target=53,protocol=tcp,mode=ingress \
  --publish published=8053,target=8053,protocol=tcp,mode=ingress \
  --mount type=bind,src=/mnt/nas/docker/dnsmasq,dst=/mnt \
  --constraint node.role!=manager \
  --replicas=2 \
  shepner/dnsmasq:latest
⁠run just as a DHCP server in a docker swarm

Use port 8067 to manage this

Set your DHCP relay service to point at all physical nodes that this could possibly run on.

This needs '--privileged' to resolve the "⁣⁣dnsmasq-dhcp: ARP-cache injection failed: Operation not permitted" error but that isnt available with docker swarm

mkdir -p /mnt/nas/docker/dnsmasq/config
mkdir -p /mnt/nas/docker/dnsmasq/webproc_dhcp

wget -O /mnt/nas/docker/dnsmasq/webproc_dhcp/program.toml https://raw.githubusercontent.com/shepner/Docker-DNSmasq/master/program.toml
wget -O /mnt/nas/docker/dnsmasq/config/dnsmasq_dhcp.conf https://raw.githubusercontent.com/shepner/Docker-DNSmasq/master/dnsmasq.conf
wget -O /mnt/nas/docker/dnsmasq/config/dnsmasq.conf https://raw.githubusercontent.com/shepner/Docker-DNSmasq/master/dnsmasq.conf
wget -O /mnt/nas/docker/dnsmasq/resolv.conf https://raw.githubusercontent.com/shepner/Docker-DNSmasq/master/resolv.conf

sudo docker service create \
  --name DNSmasq-dhcp \
  --env WEBPROC_CONF=/mnt/webproc_dhcp/program.toml \
  --mount type=bind,src=/mnt/nas/docker/dnsmasq,dst=/mnt \
  --network host \
  --constraint node.role!=manager \
  --replicas=1 \
  shepner/dnsmasq:latest

NOTE: You will only want 1 instance with this to prevent dualing DHCP servers

Notes related to this:

⁠run as a combined DNS/DHCP server in a docker swarm

You prolly dont want to do this but its here for documentation sake

mkdir -p /mnt/nas/docker/dnsmasq/config

wget -O /mnt/nas/docker/dnsmasq/program.toml https://raw.githubusercontent.com/shepner/Docker-DNSmasq/master/program.toml
wget -O /mnt/nas/docker/dnsmasq/config/dnsmasq.conf https://raw.githubusercontent.com/shepner/Docker-DNSmasq/master/dnsmasq.conf
wget -O /mnt/nas/docker/dnsmasq/resolv.conf https://raw.githubusercontent.com/shepner/Docker-DNSmasq/master/resolv.conf

sudo docker service create \
  --name DNSmasq \
  --mount type=bind,src=/mnt/nas/docker/dnsmasq,dst=/mnt \
  --env WEBPROC_CONF=/mnt/program.toml \
  --network host \
  --constraint node.role!=manager \
  --replicas=1 \
  shepner/dnsmasq:latest

NOTE: You will only want 1 instance with this to prevent dualing DHCP servers

⁠DNSmasq documentation

Tag summary

Content type

Image

Digest

Size

11.2 MB

Last updated

about 6 years ago

docker pull shepner/dnsmasq