Block Ads in Mobile App with Pi-Hole
I’ve been spending a lot of time with a five year old and it’s… weird. I feel like if I do something wrong, I’ll scar her for life. But she also always forgets where she’s put something. So maybe she’ll forget me too :)
She plays freemium dress-up/make-up games on her android tablet. I played one of them with her. The ads almost made me throw the tablet out the window. The makeup game disables portions of the game until you watch a 10 second ad (sometimes even 30 second.) I tried to skip the ad by hitting back and the ad punished me for it by disabling the makeup tool for good. That’s when she exclaimed, “No, Julie! You’re doing it wrong.” She jammed her grubby fingers onto the tablet and hit another makeup tool. Her finger hovered over the corner waiting for the ‘x’ button to appear. She’s been trained to exit ads. It’s part of her every day routine and it made me really sad!
I remember the raspberry pi-hole project I built two years ago. It was fun but it didn’t work that well for me. It’s probably time for a rebuild. Tt’s the best thing I can do for her and I’m under lockdown anyway.
I found the old pihole project. Problem! I had built it when I had an ethernet port on my macbook. How am I going to enable ssh, connect wifi and all that jazz? Had to find an alternative way.
How to Enable SSH and WiFi without Ethernet Access
- Open the SD card
- Go to /Volume/boot
touch sshto create a file called “ssh” without any extensions. This enables you to ssh into your pi.
nano wpa_supplicant.confpaste the following into it. Update the SSID and Password.
ssid="your wifi name here"
psk="your passwork here"
- Put the SD card back in and power up the raspberry pi. It takes a minute for the raspberry pi to come up.
- I ran
ping raspberrypi.localuntil I got a response
- I ran
ssh firstname.lastname@example.org is like the coolest shortcut when it works. It automatically scans your network for connected raspberry pis. Didn’t work this time!
- So I ran
nmap -sn 192.168.1.100/24to scan my network for all connected devices. This nmap command scans the entire IP address for devices connected on this network. I found 9 devices on my network. I tried ssh-ing into all of them one by one until I found the pi-hole!
- If you’re on a mac, you can find your IP mask but going to apple > System Preferences > Network. You’ll see this screen.
- Note: If you still can’t find the pi, double check the wpa_supplicant.conf file to make sure you got the SSID/Password right. Or write the file in
/etc/wpa_supplicant/wpa_supplicant.confand make sure the power is plugged into the pi all the way! Also, when you copy and paste, sometimes the double quotes “” get corrupted. Retype those.
Now, you can ssh into it with
ssh pi@<your ip>
The default password is “raspberry”
My raspberry pi is at 192.168.1.69
So now, how do we get it running again? First, let’s check out the address. I go to “http://192.168.1.69/” and get redirected to a login page. The password is not the same as the raspberry pi password. If you don’t know it, reset the console password with
The pi-hole software is two years outdated. I ran
pihole -up to update.
DISCLAIMER: It is now several months later. I moved away from the little girl. I didn’t finish the project. Sorry, little girl. But I am coming back to finish the raspberry pihole installation for my new home :)
I reflashed a fresh copy of Raspbian Lite onto a 16gb SD card. After ssh-ing in, I ran sudo apt-get upgrade and update. Then `
curl -sSL https://install.pi-hole.net | bash` It installs pihole in one easy step!
There were a few configuration options, like whether I was setting up the pi through eth0 or wlan0, and whether or not I wanted the web interface. The installation has gotten even easier. In the past, pihole could only be set up through ethernet cable.
So, after the curl command did it’s thing, I checked out the web interface to make sure everything was good. The web interface is at http://18.104.22.168/admin or http://pi.hole/admin. (During installation, they’ll give you an autogenerated password to log into the web portal. But if you missed it or you forgot it, just run
sudo pihole -a -p to reset the password.
Next, I renamed the raspberry pi’s hostname and changed the password! Run
Next, you have to set up the pihole as your DNS server. This gets tricky because everyone has a different router. I have a FiOS gateway that is both a modem and a router. You’ll have to have access to the web interface for your router. Once in, next to “DNS Servers”, I manually typed in my raspberry pi’s IP address, 192.168.1.69. (While you’re at it, also set your raspberry pi to a static IP)
You’re done! To check if it’s working, go to the admin page and you should see numbers changing as ads get blocked on the network.
Bonus, I also changed the local DNS on my Macbook. I went to System preferences -> Network -> Advanced -> DNS Tab. You can set it to your raspberry pi. But I set it to 22.214.171.124 which is a privacy focused DNS route to give me additional network privacy. Find out more about it here: https://126.96.36.199/dns/