Affected files: .obsidian/workspace.json 2 Personal/Home Lab/Pi-Hole in Homenetwork.md
146 lines
4.9 KiB
Markdown
146 lines
4.9 KiB
Markdown
---
|
||
title: Pi-Hole in Homenetwork
|
||
created_date: 2025-10-17
|
||
updated_date: 2025-10-17
|
||
aliases:
|
||
tags:
|
||
---
|
||
# Pi-Hole in Homenetwork
|
||
I followed this tutorial: [World's Greatest Pi-hole Tutorial - Easy Raspberry Pi Project! - YouTube](https://www.youtube.com/watch?v=cE21YjuaB6o)
|
||
|
||
|
||
|
||
- Installed in goodolddell
|
||
- 192.168.1.51
|
||
- [Pi-hole goodolddell](http://192.168.1.51/admin/)
|
||
-
|
||
|
||
## DNS Settings on Router
|
||
![[Pasted image 20251017195849.png]]
|
||
|
||
## Make Pi-hole the Network’s DHCP (so all clients use it as DNS)
|
||
|
||
> Goal: Your router can’t set custom DNS, so we’ll let **Pi-hole (192.168.1.51)** hand out IP addresses **and** advertise itself as DNS. This gives you network-wide ad-blocking without touching per-device settings.
|
||
|
||
---
|
||
|
||
### Prereqs (do these first)
|
||
|
||
1) **Give Pi-hole a fixed IP**
|
||
- Make a DHCP reservation on your router for the Dell/Pi-hole at **192.168.1.51** (MAC = Dell’s NIC).
|
||
- Or set a static IP on the Pi-hole host (keep it in the router’s LAN subnet; gateway = **192.168.1.1**).
|
||
|
||
2) **Know your LAN details**
|
||
- Router (gateway): **192.168.1.1**
|
||
- Pi-hole server: **192.168.1.51**
|
||
- Choose a DHCP range that avoids statics, e.g. **192.168.1.100–192.168.1.200**
|
||
|
||
3) **Make sure Pi-hole web UI works**
|
||
- Open **http://192.168.1.51/admin**
|
||
- If needed: `sudo pihole -a -p` to set/change the password.
|
||
|
||
---
|
||
|
||
### Step 1 — Configure Pi-hole DNS (upstream)
|
||
|
||
In **Pi-hole → Settings → DNS**:
|
||
- Choose upstream resolvers (e.g., **Cloudflare** 1.1.1.1 / 1.0.0.1 or **Quad9**).
|
||
- (Optional) **Conditional Forwarding** to see client hostnames:
|
||
- Local network/CIDR: `192.168.1.0/24`
|
||
- IP of router: `192.168.1.1`
|
||
- Local domain name: e.g. `home` (or leave blank if unsure for now).
|
||
|
||
Click **Save**.
|
||
|
||
---
|
||
|
||
### Step 2 — Enable Pi-hole’s DHCP (but don’t disable router yet)
|
||
|
||
**UI method**
|
||
Pi-hole → **Settings → DHCP**:
|
||
- ✅ Enable DHCP server
|
||
- Range: **192.168.1.100** to **192.168.1.200**
|
||
- Router (gateway): **192.168.1.1**
|
||
- (Optional) Domain name: `home`
|
||
- Save
|
||
|
||
**CLI equivalent (optional)**
|
||
```bash
|
||
# On the Pi-hole host:
|
||
sudo pihole -a enabledhcp 192.168.1.100 192.168.1.200 192.168.1.1
|
||
```
|
||
|
||
> At this point Pi-hole is ready to serve DHCP, but your router is still doing it too.
|
||
|
||
---
|
||
### **Step 3 — Disable DHCP on the router (Zyxel AX7501-B1)**
|
||
|
||
Router UI → **Home Networking → LAN Setup**:
|
||
|
||
- **DHCP Server State**: **Disable**
|
||
|
||
- Apply/Save
|
||
|
||
> From now on, only Pi-hole hands out leases, setting DNS to 192.168.1.51 and gateway to 192.168.1.1.
|
||
|
||
---
|
||
### **Step 4 — Renew client leases**
|
||
Force a couple of devices to renew so they switch immediately.
|
||
|
||
- **macOS**: System Settings → Network → Wi-Fi → Details → TCP/IP → **Renew DHCP Lease** (or sudo ipconfig set en0 DHCP)
|
||
|
||
- **Linux**: sudo dhclient -r && sudo dhclient (or reconnect Wi-Fi)
|
||
|
||
- **Windows**: ipconfig /release then ipconfig /renew (run in elevated CMD)
|
||
|
||
- **iOS/Android**: toggle Wi-Fi off/on or “Forget” and reconnect
|
||
|
||
Verify on a client:
|
||
- IP is in 192.168.1.100–200
|
||
- Gateway is 192.168.1.1
|
||
- DNS is 192.168.1.51
|
||
|
||
---
|
||
### **Step 5 — Verify Pi-hole is the resolver**
|
||
On a client:
|
||
- nslookup example.com → **Server/Address** should show 192.168.1.51
|
||
- Or dig google.com and check the **SERVER** line
|
||
|
||
In Pi-hole:
|
||
- **Dashboard → Query Log** should show that client’s queries.
|
||
|
||
(Optionally visit a test page such as ads-blocker-test.com.)
|
||
|
||
---
|
||
### **Step 6 — Add static leases (optional)**
|
||
|
||
Pi-hole → **Settings → DHCP → Static DHCP leases**:
|
||
|
||
- Reserve fixed IPs for NAS, printers, servers, etc., so their IPs never change.
|
||
---
|
||
### **Day-to-day operation**
|
||
|
||
- Keep the Dell/Pi-hole **on 24/7** (it’s now your DHCP + DNS).
|
||
- For maintenance windows, either temporarily re-enable the router’s DHCP or set manual DNS on your workstation (e.g., 1.1.1.1) so you stay online while tinkering.
|
||
---
|
||
### **Undo / Rollback (if anything fails)**
|
||
1. Router: **Enable** DHCP again
|
||
- Router → Home Networking → LAN Setup → **DHCP Server State: Enable** → Apply
|
||
2. Pi-hole: **Disable** DHCP
|
||
- Pi-hole → Settings → DHCP → **Disable** → Save
|
||
- CLI: sudo pihole -a disabledhcp
|
||
3. Renew leases on clients (same steps as above) so they use the router again.
|
||
4. Emergency quick-fix on your own machine: set manual DNS (e.g., 1.1.1.1 / 8.8.8.8) until the LAN is restored.
|
||
---
|
||
### **Troubleshooting quick hits**
|
||
|
||
- **Clients still show router DNS** → They kept old leases. Renew or reconnect Wi-Fi. Confirm router DHCP is disabled.
|
||
|
||
- **Pi-hole unreachable** → Ensure it has a reserved/static IP in the same subnet; ping 192.168.1.51.
|
||
|
||
- **Local hostnames don’t resolve** → Use **Conditional Forwarding**, or add **Local DNS → DNS Records** for key devices.
|
||
|
||
- **Resolution slow/spotty** → Try a single upstream first; keep DNSSEC off until stable; avoid binding Pi-hole to a single interface.
|
||
## Todos
|
||
- [ ] disable blocking - automation: should be easy for every user
|
||
- [ ] backup pihole settings |