1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Dismiss Notice

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!

Installing pihole directly on asus router

Discussion in 'Asuswrt-Merlin' started by Tonystarr, Jun 24, 2019.

  1. Tonystarr

    Tonystarr New Around Here

    Joined:
    Jun 24, 2019
    Messages:
    3
    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.

    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 Example for Debian Jessie
    Code:
    nano /etc/apt/sources.list
    
    deb http://archive.debian.org/debian/ jessie main
    deb-src http://archive.debian.org/debian/ jessie main
    
    deb http://security.debian.org jessie/updates main
    deb-src http://security.debian.org jessie/updates main
    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.
    Code:
    curl -L https://install.pi-hole.net | bash 
    If you get back an error relating to storage space try the following instead.
    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 exit out of debian and run the following command.
    Code:
    netstat -nltup | grep 'Proto\|:53 \|:67 \|:80 \|:471 \|:5453 \|:8093'
    killall -9 dnsmasq
    Go back into debian and restart pihole-FTL service.

    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.
     
    Last edited: Jul 8, 2019
  2. Delusion

    Delusion Regular Contributor

    Joined:
    May 4, 2019
    Messages:
    92
    Thanks . Everything goes smoothly with installing Debian . I am stuck at this line:
    mount /proc

    it tells me that fstab is not configured or something of this sort. /etc/fstab is empty
    (not counting the commented line)
     
    Last edited: Jun 24, 2019
  3. martinr

    martinr Part of the Furniture

    Joined:
    Nov 27, 2014
    Messages:
    2,051
    Location:
    United Kingdom
    Welcome to the forum.

    Note, I don't 100% know what I'm doing.” You’re lucky: I don’t 1% know what I’m doing.

    I know you said you’re doing this as a learning exercise, which is a great idea: no better way to learn. But, just in case you haven’t yet come across it, and if your goals change, thelonelycoder’s Diversion

    https://www.snbforums.com/threads/diversion-the-router-ad-blocker.48538/

    is now a mature program/script that blocks ads on the router. (Best installed through AMTM.)
     
  4. Tonystarr

    Tonystarr New Around Here

    Joined:
    Jun 24, 2019
    Messages:
    3
    What happens when you enter the next command ? The only purpose for this was that those two commands seem to fix the issue where
    "curl -L https://install.pi-hole.net | bash" would come back with an error. Like I said I don't fully know what I am doing. Continue to the next commands and let me know if you have any issues. When I get off from work I will try reinstalling it and see if "mount /proc" is actually necessary.
     
  5. Delusion

    Delusion Regular Contributor

    Joined:
    May 4, 2019
    Messages:
    92
    When I try to instal pi-hole I get this error:
    Code:
    [i] Unknown free disk space!
          We were unable to determine available free disk space on this system.
          You may override this check, however, it is not recommended.
          The option '--i_do_not_follow_recommendations' can override this.
          e.g: curl -L https://install.pi-hole.net | bash /dev/stdin <option>
     
  6. Tonystarr

    Tonystarr New Around Here

    Joined:
    Jun 24, 2019
    Messages:
    3
    I will have to look into that when I get off in an hour or so. The other way that should work is by following this
    Code:
    sudo -s
    cd /
    wget -O basic-install.sh https://install.pi-hole.net
    sudo bash basic-install.sh --i_do_not_follow_recommendations
     
  7. Kamil Mirza

    Kamil Mirza New Around Here

    Joined:
    Mar 17, 2018
    Messages:
    8
    wow great stuff
    really wanted to have pihole on ASUS router
    tried this on my RT-AC68U 384.12 with Debian Jessie
    beforehand I had DoT and 512MB SWAP
    had to give router IP address (as STATIC and GATEWAY) during pihole bash install script - or else it failed
    had to compile pihole-FTL, killed dnsmasq on ASUS
    got queries from only 2 devices, maybe because of DoT
    will try again with clean firmware install someday