Download the latest release, extract and run:
$ sudo ./dns-proxy-server
Now DNS Proxy Server is your DNS server, to back everything to original state just press CTRL + C;
Actually I recomend you to run DPS using standalone method because an additional command on the host will be necessary to set DPS as default DNS when running DPS on docker if you’re using system-resolved:
$ docker run --rm --hostname dns.mageddo --name dns-proxy-server -p 5380:5380 \
--network host \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /etc/systemd/:/host/etc/systemd \
-v /etc/:/host/etc \
defreitas/dns-proxy-server
If you’re using system-resolved then run command below to restart systemd-resolved service and make DPS as default DNS changes to take effect.
$ service systemd-resolved restart
Explaining:
--network host
: Running on host mode make it possible to DPS bind the
DNS server port to the host network interface, this way all containers will have access to DPS address
and use DPS features.
If you don’t want to use that option then you can consider use DPS Network feature.
/var/run/docker.sock
: Docker socket, so DPS can query the running containers and solve their IP when asked.
/etc/systemd/:/host/etc/systemd
/ /etc/:/host/etc
: Depending on your distro you may are using system-resolved or
vanila resolv.conf to configure available DNS Servers, DPS will look at both and choose the best to be configured.
You can run DPS on Windows host without any problems except by two features
Start up DPS
docker run --name dns-proxy-server -p 5380:5380 -p 53:53/udp \
-v /var/run/docker.sock:/var/run/docker.sock \
defreitas/dns-proxy-server
Change your default internet adapter DNS to 127.0.0.1
Windows + R
and type ncpa.cpl
then press enter or go to your network interfaces Window127.0.0.1
by following the
pictures belowUncheck IPV6 because Windows can try to solve hostnames by using a IPV6 DNS server, then requests won’t be sent to DPS, actually DPS doesn’t support IPV6.
Starting some docker container and keeping it alive for DNS queries
$ docker run --rm --hostname nginx.dev.intranet \
-e 'HOSTNAMES=nginx2.dev.intranet,nginx3.dev.intranet' nginx
Solving the docker container hostname from Dns Proxy Server
$ nslookup nginx.dev.intranet
Server: 172.22.0.6
Address: 172.22.0.6#53
Non-authoritative answer:
Name: debian.dev.intranet
Address: 172.22.0.7
Google keep working was well
$ nslookup google.com
Server: 172.22.0.6
Address: 172.22.0.6#53
Non-authoritative answer:
Name: google.com
Address: 172.217.29.206
Start the server at custom port and solving from it
$ nslookup -port=8980 google.com 127.0.0.1
MAC isn’t fully supported yet but as of DPS 3 we are one step closer to solve this issue, stay tight on the discussion to keep up to date.