描述
Pi-hole 是一款开源且免费的 DNS 沉洞服务器(DNS sinkhole),能够在不安装任何客户端侧软件的前提下为设备提供网络内容屏蔽服务,非常轻量易用。搭配上家中吃灰已久的树莓派,我们就能够轻松打造属于自己的广告屏蔽助手。
在官网的介绍中,Pi-hole 主要具有以下优点:
- 易于安装和配置(号称 10 分钟安装配置一条龙)。
- 全平台,广告屏蔽服务可作用于任何设备,包括 PC、手机、平板电脑。
- 轻量,对硬件要求极低。
- 功能稳定且强大,能轻松 hold 住百万级别的请求。
- 提供了美观的 Web 数据监控仪表盘。
- 开源且免费。
配置安装
关闭自带的 DNS 服务
systemctl stop systemd-resolved systemctl disable systemd-resolved
docker-compose.yml
version: "3"
# More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/
services:
pihole:
container_name: pihole
image: pihole/pihole:latest
ports:
- "53:53/tcp"
- "53:53/udp"
- "67:67/udp"
- "80:80/tcp"
- "443:443/tcp"
environment:
TZ: 'Asia/Shanghai'
WEBPASSWORD: 'changeme'
# Volumes store your data between container upgrades
volumes:
- './etc-pihole/:/etc/pihole/'
- './etc-dnsmasq.d/:/etc/dnsmasq.d/'
# Recommended but not required (DHCP needs NET_ADMIN)
# https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
restart: unless-stopped