Updated Using WireGuard Easy with Pi Hole (markdown)

Emile Nijssen
2022-06-12 22:04:48 +02:00
parent 5bb1e139f7
commit 33729c95b0
+47 -36
@@ -1,54 +1,65 @@
Simply set the environment variable WG_DEFAULT_DNS to the IP address of your Pi-hole server, e.g. 192.168.0.2. This is an example on how to use WireGuard Easy with Pi-hole.
Example: By default, all connected clients will use Pi-Hole as DNS server.
<pre>
version: "3" ## `docker-compose.yml`:
networks:
private_network: ```yaml
ipam: version: "3.8"
driver: default
config:
- subnet: 10.2.0.0/24
services: services:
wireguard: wg-easy:
depends_on: pihole
image: weejewel/wg-easy:latest
container_name: wireguard
cap_add:
- NET_ADMIN
- SYS_MODULE
environment: environment:
- TZ=Asia/Barnaul # Change to your timezone # ⚠️ Change the server's hostname (clients will connect to):
- PASSWORD=password - WG_HOST=myhost.com
- WG_HOST=0.0.0.0 # Change to your server ip
- WG_DEFAULT_DNS=10.2.0.100 # ⚠️ Change the Web UI Password:
- PASSWORD=foobar123
# 💡 This is the Pi-Hole Container's IP Address
- WG_DEFAULT_DNS=10.8.1.3
- WG_DEFAULT_ADDRESS=10.8.0.x
image: weejewel/wg-easy
container_name: wg-easy
volumes: volumes:
- ./wireguard:/etc/wireguard - ~/.wg-easy:/etc/wireguard
ports: ports:
- "51820:51820/udp" - "51820:51820/udp"
- "51821:51821/tcp" - "51821:51821/tcp"
restart: unless-stopped
cap_add:
- NET_ADMIN
- SYS_MODULE
sysctls: sysctls:
- net.ipv4.ip_forward=1 - net.ipv4.ip_forward=1
- net.ipv4.conf.all.src_valid_mark=1 - net.ipv4.conf.all.src_valid_mark=1
restart: unless-stopped
networks: networks:
private_network: wg-easy:
ipv4_address: 10.2.0.50 ipv4_address: 10.8.1.2
pihole: pihole:
image: pihole/pihole
container_name: pihole container_name: pihole
image: pihole/pihole:latest
restart: unless-stopped
hostname: pihole
environment: environment:
TZ: "Asia/Barnaul" # Change to your timezone # ⚠️ Change the Web UI Password:
WEBPASSWORD: "password" - WEBPASSWORD=foobar123
FTLCONF_REPLY_ADDR4: 10.2.0.100
volumes: volumes:
- ./pihole/etc-pihole/:/etc/pihole/ - '~/.pihole/etc-pihole:/etc/pihole'
- ./pihole/etc-dnsmasq.d/:/etc/dnsmasq.d/ - './.pihole/etc-dnsmasq.d:/etc/dnsmasq.d'
ports:
- "53:53/tcp"
- "53:53/udp"
- "5353:80/tcp"
restart: unless-stopped
networks: networks:
private_network: wg-easy:
ipv4_address: 10.2.0.100 ipv4_address: 10.8.1.3
</pre>
networks:
wg-easy:
ipam:
config:
- subnet: 10.8.1.0/24
```
Save this file, edit the variables marked with `⚠️` and run `docker-compose up -d` in the same directory. That's it!