Chrisgtl
Regular Contributor
are you running this from chrooted Debian on the router or did you place your pihole on a raspberrypi ?
Running on a RaspberryPi4
are you running this from chrooted Debian on the router or did you place your pihole on a raspberrypi ?
sudo usermod -a -G pihole www-data
sudo chown -R pihole /etc/pihole/
This was a fun project that I took up as a learning experience. After following a few guides I managed to do this and if anyone wants to have it up and running here are the steps. Note, I don't 100% know what I'm doing. This setup just worked for my RT-AC68U router. Overall the cpu and ram seems to handle pihole without trouble. Note having ram swap set up is recommended.
For pihole v5.0 see issue guide
1. Following these guides to get Debian running on the router Stretch, Jessie, or wheezy (anything running wheezy is less likely to work due to compatibility of pi-hole.)
If you get an update error after entering "apt-get update && apt-get upgrade -y" then you need to edit the source.list (This doesn't appear to be a current issue)
Code:nano /etc/apt/sources.list
2. Getting everything ready for pihole
Code:apt-get install curl apt-get install sudo sudo -s mount /proc cat /proc/mounts > /etc/mtab
3. Installing pihole. For setup make sure the eth or vlan you choose isn't taken by using the "ip a" command.
If you get back an error relating to storage space try the following instead.Code:curl -L https://install.pi-hole.net | bash
Code:sudo -s cd / wget -O basic-install.sh https://install.pi-hole.net sudo bash basic-install.sh --i_do_not_follow_recommendations
4. Depending on the router you might have to compile FTL. You will know if this is the case if you are getting a "old kernel" error or issues with FTL that isn't related to port number. Just follow this guide for compiling. If you get an Error 1 after entering "sudo make install" that is to be expected just continue the guide.
If you get a port 53 taken error just run the following command.
Restart pihole-FTL service.Code:netstat -nltup | grep 'Proto\|:53 \|:67 \|:80 \|:471 \|:5453 \|:8093' killall -9 dnsmasq
5. Changing port 80 for the website (if needed)
Code:nano /etc/lighttpd/lighttpd.conf change it to what you want sudo /etc/init.d/lighttpd restart
Now you should have pihole running.
creating the following script and adding it to S99debian will allow pihole to start up if the router reboots.
Code:chroot /opt/debian /bin/bash <<"EOT" sudo ip address add (pihole ip) dev (eth or vlan) sudo /etc/init.d/lighttpd restart killall -9 dnsmasq sudo service pihole-FTL restart EOT
Don't forget to backup Debian.
DNS over TLS and DNSSEC can be enabled if you add stubby or unbound.
Please feel free to add suggestions or possible improvements.
Update for Pihole v5.0. Read their blog post for list of improvements and changes.
Due to issues with installing pihole v5.0 I decided to add a post providing the current issues and ways to get around it. Both of these issues will most likely be fixed in later updates?
1. (Issue with installing)
Note that this issue is only for routers that run Debian 8 or less. The current issue with installing pihole v5.0 is with php5-intl and php-xml package dependencies. These two dependencies currently can't be installed due to being missed named in pihole install code. This issues can be solved either by trying to install php7 on Debian 8, modifying pihole install code to look for the correct name of these packages, or by reinstalling the source code for pihole v4.4 and then install pihole via curl command.
2. (Issue with database read only)
This issue can be solved by the following commands in debian after installing pihole v5.0:
Code:sudo usermod -a -G pihole www-data sudo chown -R pihole /etc/pihole/
Router stats for further details:
RT-AC1900
scripts: amtm, skynet, and file swap 2g.
Firmware version: 348.15
Average memory usage: 50% or 128mb (about the same with pihole gui open)
cpu usage : low only around 5% on idle with pihole running
Lastly it should be noted that running pihole directly on these routers is not for someone who wants something that is a simple install and is stable. For that check out Diversion.
[✓] Root user check
.;;,.
.ccccc:,.
:cccclll:. ..,,
:ccccclll. ;ooodc
'ccll:;ll .oooodc
.;cll.;;looo:.
.. ','.
.',,,,,,'.
.',,,,,,,,,,.
.',,,,,,,,,,,,....
....''',,,,,,,'.......
......... .... .........
.......... ..........
.......... ..........
......... .... .........
........,,,,,,,'......
....',,,,,,,,,,,,.
.',,,,,,,,,'.
.',,,,,,'.
..'''.
[i] Skipping free disk space verification
[i] Update local cache of available packages...
[✓] Update local cache of available packages
[✗] Checking apt-get for upgraded packages
Kernel update detected. If the install fails, please reboot and try again
[i] Installer Dependency checks...
[✓] Checking for dhcpcd5
[✓] Checking for git
[✓] Checking for iproute2
[✓] Checking for whiptail
[i] SELinux not detected
[i] Using interface: ppp0
[i] Using upstream DNS: Custom (192.168.2.240, 192.168.2.240)
[i] Static IP already configured
[i] IPv4 address:
[i] IPv6 address:
[i] Web Interface On
[i] Web Server On
[i] Logging On.
[✓] Check for existing repository in /etc/.pihole
[i] Update repo in /etc/.pihole...HEAD is now at 4d25f69 Merge pull request #3321 from pi-hole/release/v5.0
[✓] Update repo in /etc/.pihole
[✓] Check for existing repository in /var/www/html/admin
[i] Update repo in /var/www/html/admin...HEAD is now at b86e4a3 Merge pull request #1247 from pi-hole/release/v5.0
[✓] Update repo in /var/www/html/admin
[i] Main Dependency checks...
[i] Checking for cron (will be installed)
[✓] Checking for curl
[i] Checking for dnsutils (will be installed)
[i] Checking for iputils-ping (will be installed)
[i] Checking for lsof (will be installed)
[i] Checking for netcat (will be installed)
[i] Checking for psmisc (will be installed)
[✓] Checking for sudo
[i] Checking for unzip (will be installed)
[✓] Checking for wget
[i] Checking for idn2 (will be installed)
[i] Checking for sqlite3 (will be installed)
[✓] Checking for libcap2-bin
[i] Checking for dns-root-data (will be installed)
[✓] Checking for libcap2
[i] Checking for lighttpd (will be installed)
[i] Checking for php5-common (will be installed)
[i] Checking for php5-cgi (will be installed)
[i] Checking for php5-sqlite (will be installed)
[i] Checking for php5-xml (will be installed)
[i] Checking for php-intl (will be installed)
[i] Processing apt-get install(s) for: cron dnsutils iputils-ping lsof netcat psmisc unzip idn2 sqlite3 dns-root-data lighttpd php5-common php5-cgi php5-sqlite php5-xml php-i.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php5-xml
E: Unable to locate package php-intl
\u@\h:\w$
Scroll up 3 postsI think I have an isue - can anyone help please?
Code:[✓] Root user check .;;,. .ccccc:,. :cccclll:. ..,, :ccccclll. ;ooodc 'ccll:;ll .oooodc .;cll.;;looo:. .. ','. .',,,,,,'. .',,,,,,,,,,. .',,,,,,,,,,,,.... ....''',,,,,,,'....... ......... .... ......... .......... .......... .......... .......... ......... .... ......... ........,,,,,,,'...... ....',,,,,,,,,,,,. .',,,,,,,,,'. .',,,,,,'. ..'''. [i] Skipping free disk space verification [i] Update local cache of available packages... [✓] Update local cache of available packages [✗] Checking apt-get for upgraded packages Kernel update detected. If the install fails, please reboot and try again [i] Installer Dependency checks... [✓] Checking for dhcpcd5 [✓] Checking for git [✓] Checking for iproute2 [✓] Checking for whiptail [i] SELinux not detected [i] Using interface: ppp0 [i] Using upstream DNS: Custom (192.168.2.240, 192.168.2.240) [i] Static IP already configured [i] IPv4 address: [i] IPv6 address: [i] Web Interface On [i] Web Server On [i] Logging On. [✓] Check for existing repository in /etc/.pihole [i] Update repo in /etc/.pihole...HEAD is now at 4d25f69 Merge pull request #3321 from pi-hole/release/v5.0 [✓] Update repo in /etc/.pihole [✓] Check for existing repository in /var/www/html/admin [i] Update repo in /var/www/html/admin...HEAD is now at b86e4a3 Merge pull request #1247 from pi-hole/release/v5.0 [✓] Update repo in /var/www/html/admin [i] Main Dependency checks... [i] Checking for cron (will be installed) [✓] Checking for curl [i] Checking for dnsutils (will be installed) [i] Checking for iputils-ping (will be installed) [i] Checking for lsof (will be installed) [i] Checking for netcat (will be installed) [i] Checking for psmisc (will be installed) [✓] Checking for sudo [i] Checking for unzip (will be installed) [✓] Checking for wget [i] Checking for idn2 (will be installed) [i] Checking for sqlite3 (will be installed) [✓] Checking for libcap2-bin [i] Checking for dns-root-data (will be installed) [✓] Checking for libcap2 [i] Checking for lighttpd (will be installed) [i] Checking for php5-common (will be installed) [i] Checking for php5-cgi (will be installed) [i] Checking for php5-sqlite (will be installed) [i] Checking for php5-xml (will be installed) [i] Checking for php-intl (will be installed) [i] Processing apt-get install(s) for: cron dnsutils iputils-ping lsof netcat psmisc unzip idn2 sqlite3 dns-root-data lighttpd php5-common php5-cgi php5-sqlite php5-xml php-i. --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package php5-xml E: Unable to locate package php-intl \u@\h:\w$
1. (Issue with installing)
Note that this issue is only for routers that run Debian 8 or less. The current issue with installing pihole v5.0 is with php5-intl and php-xml package dependencies. These two dependencies currently can't be installed due to being missed named in pihole install code. This issues can be solved either by trying to install php7 on Debian 8, modifying pihole install code to look for the correct name of these packages, or by reinstalling the source code for pihole v4.4 and then install pihole via curl command.
Scroll up 3 posts
This isn't my project so I don't know.Hi Jack
could you please outline exact steps for re-installing the 4.4 source code? I have the Tar.gz package. I assume the
command to install Pihole :- curl -L https://install.pi-hole.net | bash is still valid?
Hi Jack
could you please outline exact steps for re-installing the 4.4 source code? I have the Tar.gz package. I assume the
command to install Pihole :- curl -L https://install.pi-hole.net | bash is still valid?
FTLDNS can now be compiled and installed:
make -j $(nproc)
sudo make install
root@RT-AC5300-0680:/nettle-3.6/FTL# sudo make install
cc -std=gnu11 -pipe -Isrc -Wall -Wextra -Wno-unused-parameter -D_FILE_OFFSET_BITS=64 -fstack-protector-strong -Wp,-D_FORTIFY_SOURCE=2 -O3 -Wl,-z,relro,-z,now -fexceptions -funwind-tables -fasynchronous-unwind-tables -Wl,-z,defs -Wl,-z,now -Wl,-z,relro -pie -fPIE -rdynamic -fno-omit-frame-pointer -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_MEMORYDB -DSQLITE_DEFAULT_FOREIGN_KEYS=1 -DSQLITE_DQS=0 -DHAVE_POLL_H -o pihole-FTL build/database/common.o build/database/query-table.o build/database/network-table.o build/database/gravity-db.o build/database/database-thread.o build/database/sqlite3-ext.o build/api/socket.o build/api/request.o build/api/msgpack.o build/api/api.o build/main.o build/memory.o build/log.o build/daemon.o build/datastructure.o build/signals.o build/files.o build/setupVars.o build/args.o build/gc.o build/config.o build/dnsmasq_interface.o build/resolve.o build/regex.o build/shmem.o build/capabilities.o build/overTime.o build/timers.o build/vector.o build/dnsmasq/arp.o build/dnsmasq/dbus.o build/dnsmasq/domain.o build/dnsmasq/lease.o build/dnsmasq/outpacket.o build/dnsmasq/rrfilter.o build/dnsmasq/auth.o build/dnsmasq/dhcp6.o build/dnsmasq/edns0.o build/dnsmasq/log.o build/dnsmasq/poll.o build/dnsmasq/slaac.o build/dnsmasq/blockdata.o build/dnsmasq/dhcp.o build/dnsmasq/forward.o build/dnsmasq/loop.o build/dnsmasq/radv.o build/dnsmasq/tables.o build/dnsmasq/bpf.o build/dnsmasq/dhcp-common.o build/dnsmasq/helper.o build/dnsmasq/netlink.o build/dnsmasq/rfc1035.o build/dnsmasq/tftp.o build/dnsmasq/cache.o build/dnsmasq/dnsmasq.o build/dnsmasq/inotify.o build/dnsmasq/network.o build/dnsmasq/rfc2131.o build/dnsmasq/util.o build/dnsmasq/conntrack.o build/dnsmasq/dnssec.o build/dnsmasq/ipset.o build/dnsmasq/option.o build/dnsmasq/rfc3315.o build/dnsmasq/crypto.o build/dnsmasq/dump.o build/dnsmasq/ubus.o build/dnsmasq/metrics.o build/database/sqlite3.o -pthread -lrt -Wl,-Bstatic -L/usr/local/lib -lhogweed -lgmp -lnettle -Wl,-Bdynamic
/usr/bin/ld: cannot find -lhogweed
collect2: error: ld returned 1 exit status
Makefile:160: recipe for target 'pihole-FTL' failed
make: *** [pihole-FTL] Error 1
I personally don't recommend attempting this locally on the router. if you truly want to enjoy it, then you should run it from a virtual machine, or cloud based virtual machine, or on a rpiI get errors in last step
Code:FTLDNS can now be compiled and installed: make -j $(nproc) sudo make install
Personally I dont think this is worth the time and effort for a non Linux person like me
Code:root@RT-AC5300-0680:/nettle-3.6/FTL# sudo make install cc -std=gnu11 -pipe -Isrc -Wall -Wextra -Wno-unused-parameter -D_FILE_OFFSET_BITS=64 -fstack-protector-strong -Wp,-D_FORTIFY_SOURCE=2 -O3 -Wl,-z,relro,-z,now -fexceptions -funwind-tables -fasynchronous-unwind-tables -Wl,-z,defs -Wl,-z,now -Wl,-z,relro -pie -fPIE -rdynamic -fno-omit-frame-pointer -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_MEMORYDB -DSQLITE_DEFAULT_FOREIGN_KEYS=1 -DSQLITE_DQS=0 -DHAVE_POLL_H -o pihole-FTL build/database/common.o build/database/query-table.o build/database/network-table.o build/database/gravity-db.o build/database/database-thread.o build/database/sqlite3-ext.o build/api/socket.o build/api/request.o build/api/msgpack.o build/api/api.o build/main.o build/memory.o build/log.o build/daemon.o build/datastructure.o build/signals.o build/files.o build/setupVars.o build/args.o build/gc.o build/config.o build/dnsmasq_interface.o build/resolve.o build/regex.o build/shmem.o build/capabilities.o build/overTime.o build/timers.o build/vector.o build/dnsmasq/arp.o build/dnsmasq/dbus.o build/dnsmasq/domain.o build/dnsmasq/lease.o build/dnsmasq/outpacket.o build/dnsmasq/rrfilter.o build/dnsmasq/auth.o build/dnsmasq/dhcp6.o build/dnsmasq/edns0.o build/dnsmasq/log.o build/dnsmasq/poll.o build/dnsmasq/slaac.o build/dnsmasq/blockdata.o build/dnsmasq/dhcp.o build/dnsmasq/forward.o build/dnsmasq/loop.o build/dnsmasq/radv.o build/dnsmasq/tables.o build/dnsmasq/bpf.o build/dnsmasq/dhcp-common.o build/dnsmasq/helper.o build/dnsmasq/netlink.o build/dnsmasq/rfc1035.o build/dnsmasq/tftp.o build/dnsmasq/cache.o build/dnsmasq/dnsmasq.o build/dnsmasq/inotify.o build/dnsmasq/network.o build/dnsmasq/rfc2131.o build/dnsmasq/util.o build/dnsmasq/conntrack.o build/dnsmasq/dnssec.o build/dnsmasq/ipset.o build/dnsmasq/option.o build/dnsmasq/rfc3315.o build/dnsmasq/crypto.o build/dnsmasq/dump.o build/dnsmasq/ubus.o build/dnsmasq/metrics.o build/database/sqlite3.o -pthread -lrt -Wl,-Bstatic -L/usr/local/lib -lhogweed -lgmp -lnettle -Wl,-Bdynamic /usr/bin/ld: cannot find -lhogweed collect2: error: ld returned 1 exit status Makefile:160: recipe for target 'pihole-FTL' failed make: *** [pihole-FTL] Error 1
I personally don't recommend attempting this locally on the router. if you truly want to enjoy it, then you should run it from a virtual machine, or cloud based virtual machine, or on a rpi
I have a very successful setup of AX88U and and a Raspberry Pi (running PiHole5 + Unbound)...
... however, seeing your post got me interested that I could run PiHole 5 & Unbound on the AX88U itself and have a cleaner, single system. I can then get rid of the RPi (or use for for other stuff).
Few questions?
I would prefer to start from a clean install to isolate any issues.
So basic Asus-Merlin installed, 4GB USB attached, 2GB swap on USB configured.
Nothing else installed on Merlin. Router working fine - no issues.
1) What are the best steps to follow? Install Unbound and then PiHole or PiHole first and then Unbound?
2) How do I ensure that all PiHole logs/ databases are written to an external USB (with Swap); as I do not wish PiHole to clog up the router flash?
3) Any specific settings for Unbound and PiHole?
My router is 192.168.1.1 (and assume no Raspberry Pi for this particular setup)
Any help would be much appreciated...
I personally don't recommend attempting this locally on the router. if you truly want to enjoy it, then you should run it from a virtual machine, or cloud based virtual machine, or on a rpi
Hi Jack
could you please outline exact steps for re-installing the 4.4 source code? I have the Tar.gz package. I assume the
command to install Pihole :- curl -L https://install.pi-hole.net | bash is still valid?
sudo bash basic-install.sh
curl -L https://install.pi-hole.net | bash
that's the best thing to use an rpi for, it's what i'm going to be doingThanks for this, I have couple pi4 sitting here
curl -L https://install.pi-hole.net | bash
main: line 192: /dev/fd/62: No such file or directory
admin@asusAX68U:/tmp/mnt/asusWrt/entware# debian start
Starting chroot'ed Debian services...
mount: mounting /dev on /tmp/mnt/sda1/entware/debian/dev failed: No such file or directory
mount: mounting /proc on /tmp/mnt/sda1/entware/debian/proc failed: No such file or directory
mount: mounting /sys on /tmp/mnt/sda1/entware/debian/sys failed: No such file or directory
root@asusAX68U:/# sudo -s
\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$
\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$ mount /proc
mount: /proc: can't find in /etc/fstab.
how would like pihole on the router on separate ip?
looks like you need to modify the sda1 parts of your mount points to be asusWrt since that is the name of your Mount point.So you all were able to install debian?
Do I need to to the mount thing thing on this page https://hqt.ro/how-to-install-debian-stretch-arm/ ?
Also if I eventually succeed how would like pihole on the router on separate ip?
I could still run
Inside debian, but it ends withCode:curl -L https://install.pi-hole.net | bash
Code:main: line 192: /dev/fd/62: No such file or directory
debian issues
Code:admin@asusAX68U:/tmp/mnt/asusWrt/entware# debian start Starting chroot'ed Debian services... mount: mounting /dev on /tmp/mnt/sda1/entware/debian/dev failed: No such file or directory mount: mounting /proc on /tmp/mnt/sda1/entware/debian/proc failed: No such file or directory mount: mounting /sys on /tmp/mnt/sda1/entware/debian/sys failed: No such file or directory
Code:root@asusAX68U:/# sudo -s \[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$ \[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$ mount /proc mount: /proc: can't find in /etc/fstab.
Welcome To SNBForums
SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.
If you'd like to post a question, simply register and have at it!
While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!