1. Install Pi-hole and Assign a Static IP
- Install Pi-hole: Follow the official installation guide from Pi-hole’s website.
- Assign a Static IP: During installation, Pi-hole will prompt you to set a static IP. Ensure this IP is within your network's range and not conflicting with other devices.
2. Access the Pi-hole Web Interface
- Open a browser and navigate to
http://<pi-hole-ip-address>/admin
. - Log in using the password provided during installation or configured later.
3. Configure DHCP Settings in Pi-hole
- Navigate to DHCP Settings: Go to
Settings
->DHCP
. - Enable DHCP Server: Check the box to enable the DHCP server.
- Enter Router IP and IP Range:
- Router IP Address: Enter your router's IP address.
- IP Range: Copy the DHCP range from your router settings and enter it here. For example, if your router's DHCP range is 192.168.1.2 to 192.168.1.254, enter the same range.
4. Advanced DHCP Settings
- Enable DHCPv4 Rapid Commit: Check the box for "Enable DHCPv4 rapid commit (fast address assignment)".
- Enable IPv6 Support: Check the box for "Enable IPv6 support (SLAAC + RA)".
5. Set Static DHCP Leases
- Navigate to DHCP Leases: Scroll down to the "Static DHCP Leases Configuration".
- Add Static Lease for Router:
- If you dont know anything about Static Addresses, scroll down, there is a section for it.
- Static MAC Address of Router: Enter the STATIC MAC address of your router. This information is typically found in your router's settings or on a label on the device. This step is crucial to ensure your router consistently gets the same IP address.
- STATIC IP Address of Router: Enter the IP address of your router. Using the static IP of your router here is essential for proper network configuration.
- You can also enter the normal (dynamic) IP of your router to be thorough. (Just to be safe)
- Static IP of Pi-hole: Also add the static IP of your Pi-hole to ensure it remains consistent. (Just to be safe)
- Click the
+
button to add the entry and thenSave
.
6. Configure DNS Settings in Pi-hole
- Navigate to DNS Settings: Go to
Settings
->DNS
. - Upstream DNS Servers:
- Add the static IP address of your router as one of the upstream DNS servers. It is very important to use the static IP of your router here to ensure reliable DNS resolution.
- You may also add the static IP of your Pi-hole (this is optional, but can be done if needed). (Just to be safe)
- You may also add other DNS servers (e.g., Google DNS, OpenDNS) if needed.
- Check the relevant boxes to enable these servers.
- Conditional Forwarding (optional):
- If you want to resolve local hostnames, enable conditional forwarding.
- Enter your router’s IP and local domain name.
7. Restart Pi-hole or DHCP Server
- Restart Pi-hole: Restart the Pi-hole device to ensure it recognizes and applies the new settings. You can do this through the Pi-hole web interface or by rebooting the device.
- Restart DHCP Server:
- Router DHCP Server: Temporarily disable and then re-enable the DHCP server on your router. This action forces the router to recognize the Pi-hole as the DHCP server. Do not permanently disable it yet; just turn it off and then back on until it recognizes the Pi-hole.
- Pi-hole DHCP Server: Ensure the Pi-hole DHCP server is enabled and running.
8. Finalizing Configuration
- Double-check all entries for accuracy.
- Click
Save
to apply the settings.
Verification and Troubleshooting
- Restart Devices: Restart your router and any connected devices to ensure they receive the new DHCP settings.
- Check Pi-hole Logs: Look at the Pi-hole query logs to confirm that DNS requests are being routed through Pi-hole.
- Test Connectivity: Ensure internet connectivity on all devices. Use
nslookup
ordig
to verify that DNS queries are being handled by Pi-hole.
Notes
- Leave Router DHCP Enabled Initially: Leave the DHCP server on the router enabled initially. Temporarily disable and re-enable it to ensure it recognizes the Pi-hole.
- Static IP and MAC Address Importance: Keeping Pi-hole’s IP static and ensuring the router’s Static and IP MAC address is correctly entered are crucial steps. These ensure that the router consistently gets the same IP address and that DNS resolution remains reliable.
- Permanently Disable Router DHCP (Optional): Once Pi-hole is recognized as the DHCP server and everything is working correctly, you can consider permanently disabling the DHCP server on your router to avoid conflicts.
- Include Normal IP of Router: You can also enter the normal (dynamic) IP of your router in the Static DHCP leases configuration settings. Maybe very important to get the PI even working on your Router (You see it green in the Queries after some time) (Just to be safe)
- Or easy, just buy a router with DNS Options (Asus, etc...)
Only important if you dont know what static and dynamic Router address are otherwise ignore it:
Edit : Static MAC and IP of the router : If you're confused about what I mean by static and dynamic IP, MAC addresses of the router...:
In your router's network settings, you'll likely find an option to view your Static IP for the Router. Additionally, there will be a STATIC MAC address associated with its STATIC IP, which is different from the dynamically assigned IP and MAC of the Router.
The IP address of the static assignment is usually longer and unique for each router (STATIC). It's crucial to use this specific STATIC MAC address and STATIC IP OF THE ROUTER when configuring static DHCP leases in Pi-hole, rather than the MAC address associated with the dynamically assigned IP.
This ensures that the router consistently receives the same IP address from Pi-hole. So, instead of using the IP "192.168.0.1", you should use the Static IP of your ROUTER along with its corresponding STATIC MAC address found in your router's settings.
This way, your Pi-hole works automatically on all devices that connect to your WLAN. If you have a second router, you can TRY and SHOULD adding the Pi-hole's static IP to DNS settings; however, typically, all traffic runs through the FIRST router and should be filtered accordingly. Ensure to perform these configurations also on your 2nd Router (if you have one) and on your MAIN router.
Locate Router's Network Settings: Access your router's administration panel through a web browser. Typically, you can do this by entering your router's IP address (usually something like "192.168.0.1") into the address bar. Log in using your router's username and password.
- Find Static IP for the Router: Look for an option related to network settings or LAN settings. Within this section, you should find an option for finding the Static IP of your router. This static IP address will be used to ensure consistency in network configurations.
- Identify Static MAC Address: Alongside the static IP address, you'll also find a MAC address associated with it. This MAC address is unique to your router and is used to identify it on the network. Make note of this MAC address as you'll need it later.
- Configure Static DHCP Lease in Pi-hole: Access the Pi-hole web interface and navigate to the DHCP settings. Find the section for setting static DHCP leases. Here, you'll add an entry for your router.
- Enter Router's Static MAC and IP: In the static DHCP lease configuration, enter the MAC address you found earlier along with the static IP address assigned to your router. This ensures that your router always receives the same IP address from Pi-hole.
- Update DNS Settings in Pi-hole: Navigate to the DNS settings in the Pi-hole web interface. Add the static IP address of your router as one of the upstream DNS servers. This ensures reliable DNS resolution for your network.
- Verify Configuration: Double-check all entries for accuracy. Ensure that you've used the correct static IP address and MAC address for your router.
- Save Settings and Test: Click save to apply the settings. Restart your Pi-hole device to ensure it recognizes and applies the new settings. You can also restart your router for good measure.
[link] [comments]
No comments:
Post a Comment