DNS and adblock with Blocky
Installation
docker-compose.yml
version: "2"
services:
blocky:
image: spx01/blocky
container_name: blocky
restart: unless-stopped
ports:
- "53:53/tcp"
- "53:53/udp"
- "4000:4000/tcp"
environment:
- TZ=${TZ}
volumes:
- /etc/localtime:/etc/localtime:ro
- ./config:/app/config.yml
labels:
traefik.enable: true
traefik.http.routers.blocky.rule: Host(`blocky.${SITE}`)
traefik.http.routers.blocky.entrypoints: websecure
traefik.http.routers.blocky.middlewares: secured@file
traefik.http.services.blocky.loadbalancer.server.port: 4000
config/config.yml
upstream:
default:
- 192.168.0.1
- 1.1.1.1
blocking:
blackLists:
ads:
- https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
clientGroupsBlock:
default:
- ads
ports:
dns: 53
http: 4000
See also
Adding custom DNS entries
We assume the machine has the IP 192.168.0.2
.
Create the file config/dns.yml
and add the following
customDNS:
mapping:
example.com: 192.168.0.2
blocky.example.com: 192.168.0.2
other.example.com: 192.168.0.2
This will route the given sites internally via blocky.
Now simply set the IP as your DNS-Server in your Routers DHCP config