-
Notifications
You must be signed in to change notification settings - Fork 0
Install on Asuswrt‐Merlin
This guide will configure Pi-hole to replace the firmware's DNS resolver.
-
Install Entware: https://github.com/Entware/Entware/wiki/Install-on-Asuswrt-Merlin-firmware
-
Add
piholeuser in USB Application -> Servers Center -> Samba.
Alternatively, you could also use/jffs/configs/passwd.addand/jffs/configs/group.add(look here for help). -
Install Pi-hole package: https://github.com/jacklul/entware-pi-hole/wiki#installation
During the installation a random password will be generated for the web interface, you can change it withpihole setpasswordcommand later. -
Enable custom scripts by turning on
Enable JFFS custom scripts and configsin Administration -> System. -
Create
/jffs/scripts/dnsmasq.postconf:
#!/bin/sh
[ -z "$1" ] && exit 1
# Make firmware Dnsmasq listen for DNS on non-default port (we need it for the reverse lookups)
if ! grep -q "^port=8053" "$1"; then
sed '/^port=/ s/^/#/' -i "$1"
sed "/^user=/a port=8053" -i "$1"
fi
# Make sure system uses Pi-hole for DNS requests
# This is optional, you can skip it if you don't want software
# and addons installed on the router to query Pi-hole
resolvconf="$(readlink -f /etc/resolv.conf)"
if ! head -n 1 "$resolvconf" | grep -q "^nameserver 127.0.0.1"; then
sed '/127.0.0.1/d' -i "$resolvconf"
sed '1i nameserver 127.0.0.1' -i "$resolvconf"
fi-
Make it executable -
chmod +x /jffs/scripts/dnsmasq.postconf -
Edit
/opt/etc/pihole/pihole.tomland modify:
Change192.168.1.0/24to match your LAN network andlanto match your LAN domain name.
[dns]
upstreams = [
"1.1.1.1", # As an example we are using Cloudflare DNS servers here
"1.0.0.1" # This can also be set in the web interface -> Settings -> DNS
]
port = 53
interface = "br0"
listeningMode = "LOCAL" # set to 'ALL' if VPN clients can't access Pi-hole DNS, ensure firewall blocks public access to the port set above
revServers = [
"true,192.168.1.0/24,127.0.0.1#8053,lan"
]
# Disable NTP feature as it may conflict with firmware's NTP server and sync
[ntp]
[ntp.ipv4]
active = false
[ntp.ipv6]
active = false
[ntp.sync]
active = false
[webserver]
port = "5080,5443s"-
In your router's web GUI go to LAN -> DHCP Server and make sure
Advertise router's IP in addition to user-specified DNSis turned on and no other DNS server is set in that section (DNS set on the WAN page should be external).
You should also disableForward local domain queries to upstream DNSin WAN -> Internet Connection as it can create a DNS loop withdns.revServersset. -
Restart Dnsmasq and start Pi-hole service:
service restart_dnsmasq
/opt/etc/init.d/S65pihole-FTL startNote
It is possible that you will see "dnsmasq warning: using interface lo instead" in Pi-hole's web interface and FTL.log - it can be safely ignored as it only indicates that one of the interfaces is either virtual or labeled.
In this particular case it will be caused by lo:0 interface created by ASUS firmware.
- Access Pi-hole's web interface at asusrouter.com:5080 or asusrouter.com:5443 and proceed to configuration.