Ana içeriğe geç
Kategoriye Dön

Pi-hole ve AdGuard Home Kurulumu: Ağ Genelinde Reklam Engelleme

Pi-hole ve AdGuard Home Docker kurulumu, DNS yapılandırması, blocklist yönetimi, DHCP sunucusu, whitelist/blacklist, istatistikler ve DoH/DoT desteği.

Okuma süresi: 14 dk Self-Hosting
pi-holeadguarddnsreklam engellemeself-hostingdockerağ güvenliği

İçindekiler

Pi-hole ve AdGuard Home Kurulumu: Ağ Genelinde Reklam Engelleme

Pi-hole ve AdGuard Home, ağınızdaki tüm cihazlar için DNS tabanlı reklam ve izleyici engelleme sağlayan self-hosted çözümlerdir. Tarayıcı eklentilerinin aksine, ağ genelinde çalışarak akıllı TV, oyun konsolu ve mobil uygulamalardaki reklamları da engeller.

Pi-hole vs AdGuard Home Karşılaştırması

ÖzellikPi-holeAdGuard Home
ArayüzKlasik, işlevselModern, kullanıcı dostu
DoH/DoTEklenti gerekirYerleşik
DHCPDesteklerDestekler
Regex KurallarSınırlıGelişmiş
KurulumKolayÇok kolay
PerformansİyiÇok iyi
ÖnerilenDeneyimlilerYeni başlayanlar

Sistem Gereksinimleri

  • Docker ve Docker Compose kurulu sunucu veya Raspberry Pi
  • Minimum 512 MB RAM
  • Statik IP adresi (DNS sunucusu için önemli)
  • 53 portu kullanılabilir olmalı

Pi-hole Docker Kurulumu

hljs yaml
# docker-compose.yml
version: '3.8'

services:
  pihole:
    image: pihole/pihole:latest
    container_name: pihole
    restart: unless-stopped
    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "127.0.0.1:8080:80"
    environment:
      TZ: 'Europe/Istanbul'
      WEBPASSWORD: 'guclu-sifre'
      PIHOLE_DNS_: '1.1.1.1;8.8.8.8'
      DNSSEC: 'true'
      DNSMASQ_LISTENING: 'all'
    volumes:
      - ./pihole/etc-pihole:/etc/pihole
      - ./pihole/etc-dnsmasq.d:/etc/dnsmasq.d
    cap_add:
      - NET_ADMIN
hljs bash
# 53 portunu kullanan servisi durdur (Ubuntu)
sudo systemctl stop systemd-resolved
sudo systemctl disable systemd-resolved

# /etc/resolv.conf güncelle
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf

# Pi-hole başlat
docker compose up -d

Ubuntu'da systemd-resolved 53 portunu kullanır. Pi-hole'u başlatmadan önce bu servisi durdurmanız gerekir.

AdGuard Home Docker Kurulumu

hljs yaml
version: '3.8'

services:
  adguardhome:
    image: adguard/adguardhome:latest
    container_name: adguardhome
    restart: unless-stopped
    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "127.0.0.1:3000:3000"  # İlk kurulum
      - "127.0.0.1:8080:80"    # Web arayüzü
      - "853:853/tcp"           # DNS-over-TLS
      - "443:443/tcp"           # DNS-over-HTTPS
    volumes:
      - ./adguard/work:/opt/adguardhome/work
      - ./adguard/conf:/opt/adguardhome/conf
hljs bash
docker compose up -d
# İlk kurulum: http://SUNUCU_IP:3000

DNS Yapılandırması

Router'da DNS Ayarlama (Önerilen)

Tüm ağ cihazları için en kolay yöntem router'da DNS'i değiştirmektir:

Router Yönetim Paneli → DHCP Ayarları
Primary DNS: SUNUCU_IP (Pi-hole/AdGuard IP)
Secondary DNS: 1.1.1.1 (yedek)

Cihaz Bazlı DNS Ayarlama

hljs bash
# Linux
sudo nano /etc/resolv.conf
nameserver SUNUCU_IP

# Windows (PowerShell)
Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ServerAddresses SUNUCU_IP

Blocklist Yönetimi

Pi-hole Blocklist Ekleme

Group Management → Adlists → Add

Popüler listeler:
https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
https://adaway.org/hosts.txt
https://v.firebog.net/hosts/Easylist.txt
https://v.firebog.net/hosts/Easyprivacy.txt
https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/spy.txt
hljs bash
# Gravity güncelle (listeleri yenile)
docker exec pihole pihole -g

AdGuard Home Filtre Listesi

Filters → DNS blocklists → Add blocklist

Önerilen listeler:
- AdGuard DNS filter (varsayılan)
- EasyList
- EasyPrivacy
- Malware Domains
- AdAway Default Blocklist

Whitelist ve Blacklist

Pi-hole

hljs bash
# Whitelist'e ekle
docker exec pihole pihole -w example.com

# Blacklist'e ekle
docker exec pihole pihole -b ads.example.com

# Regex blacklist
docker exec pihole pihole --regex '(^|\.)ads\..*'

# Listeleri görüntüle
docker exec pihole pihole -q example.com

AdGuard Home

Filters → Custom filtering rules

# Engelle
||ads.example.com^

# İzin ver (whitelist)
@@||example.com^

# Regex engelle
/^ads\..*/

DHCP Sunucusu

Pi-hole veya AdGuard Home'u DHCP sunucusu olarak kullanabilirsiniz:

Pi-hole: Settings → DHCP
- DHCP server enabled: Etkin
- Range: 192.168.1.100 - 192.168.1.200
- Router: 192.168.1.1
- Lease time: 24 saat

AdGuard Home: Settings → DHCP settings
- Enable DHCP server
- IP range: 192.168.1.100 - 192.168.1.200
- Gateway: 192.168.1.1

DHCP'yi etkinleştirmeden önce router'daki DHCP'yi devre dışı bırakın. İki DHCP sunucusu ağ sorunlarına yol açar.

DoH ve DoT Yapılandırması

AdGuard Home ile DoH/DoT

hljs yaml
# AdGuard Home otomatik olarak destekler
# SSL sertifikası gerekir

Settings  Encryption settings:
- Enable encryption: Etkin
- Server name: dns.example.com
- HTTPS port: 443
- DNS-over-TLS port: 853
- Certificate: /opt/adguardhome/conf/cert.pem
- Private key: /opt/adguardhome/conf/key.pem

Pi-hole ile DoH (Cloudflared)

hljs yaml
# docker-compose.yml'e ekle
cloudflared:
  image: cloudflare/cloudflared:latest
  container_name: cloudflared
  restart: unless-stopped
  command: proxy-dns --port 5053 --upstream https://1.1.1.1/dns-query
  network_mode: host
Pi-hole → Settings → DNS
Custom DNS: 127.0.0.1#5053

İstatistik Dashboard

Pi-hole Dashboard: http://SUNUCU_IP/admin
- Toplam sorgular
- Engellenen sorgular (%)
- En çok engellenen domainler
- En aktif istemciler
- Zaman bazlı grafik

AdGuard Home Dashboard: http://SUNUCU_IP:8080
- DNS sorgu istatistikleri
- Engelleme oranı
- Üst engellenen domainler
- İstemci istatistikleri

Nginx ile Web Arayüzü

hljs nginx
server {
    listen 443 ssl http2;
    server_name dns.example.com;

    ssl_certificate /etc/letsencrypt/live/dns.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/dns.example.com/privkey.pem;

    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

REXE VPS sunucularında Pi-hole veya AdGuard Home kurarak tüm sunucu trafiğinizi filtreyebilirsiniz. Özellikle birden fazla container çalıştıran ortamlarda DNS tabanlı filtreleme çok etkilidir.