Pi-hole is a linux based web application, which is used as a shield from the unwanted advertisement in your network and also block the internet tracking system.This is very simple to use and best for home and small office networks. This is totally free and opensource. It also allows you to manage your accessibility and blocklist as well. It has a very descent graphical way of showing the network queries. Docker is a tool that works on containerization technology. This is used to launch containers for different requirements like a webserver, a dns and many more. To know more about docker you check it out here on GeeksForGeeks and for launching your own web server on docker you could see here.
How to setup pi-hole and Docker?
Open your terminal and Start docker
sudo systemctl start docker
Enter the command to download pihole from docker hub
sudo docker pull pihole/pihole
Step 2: Skip this if you are not using ubuntu
sudo systemctl stop systemd-resolved.service
sudo systemctl disable systemd-resolved.service
Change the DNS to something else like google
sudo gedit /etc/resolv.conf
set dns 18.104.22.168 and save.
Copy this code
version: "3" services: pihole: container_name: pihole image: pihole/pihole:latest ports: - "53:53/tcp" - "53:53/udp" - "67:67/udp" - "80:80/tcp" - "443:443/tcp" environment: TZ: 'Asia/Kolkata' #this is the time zone volumes: - './etc-pihole/:/etc/pihole/' - './etc-dnsmasq.d/:/etc/dnsmasq.d/' dns: - 127.0.0.1 - 22.214.171.124 cap_add: - NET_ADMIN restart: unless-stopped
Open a File
sudo gedit pihole.sh
copy paste the above code here and save the file.
Give permissions to the shell file
sudo chmod u+x pihole
Run the file to launch pihole
Move inside pihole container
sudo docker exec -it pihole bash
Change pihole password
pihole -a -p
Go to browser and search
Use IP and copy paste the ip to browser
Login with the password
That’s it all set.
Now use the pihole as your DNS instead of any other.
Go to dns setting in your windows…
settings –> Network and Internet –> Ethernet (if you are connected to ethernet) or WiFi ( if your laptop connected to wifi) –> change adapter options –>right click on wifi or ethernet and go to properties –> select ipv4 –> properties –> change the dns to the ip of pihole.
Change the DNS from optain DNS automatically to Use following dns server and write the ip the box. In second you could write any dns like 126.96.36.199
Same Pi-hole IP can be used in the home router as DNS.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- Difference between Secure Socket Layer (SSL) and Secure Electronic Transaction (SET)
- Setting up a Basic Home Network using Packet Tracer
- Making your own Linux Shell in C
- How to Build Your Own Commands in Linux?
- Introduction of Home Area Network (HAN)
- Difference between File Transfer Protocol (FTP) and Secure File Transfer Protocol (SFTP)
- Difference between Secure Socket Layer (SSL) and Transport Layer Security (TLS)
- Trust Based Energy-Efficient and Secure Routing Protocols for IoT
- Secure Electronic Transaction (SET) Protocol
- Secure Socket Layer (SSL)
- Introduction to SSH(Secure Shell) Keys
- Why HTTP is not Secure ?
- How to Secure a Live Server?
- How to Install and Configure Docker in Ubuntu?
- Difference between Storage Area Network (SAN) and Network Attached Storage (NAS)
- Differences between Wireless Adhoc Network and Wireless Sensor Network
- Difference between Next Generation Network and Traditional Network
- Difference between Software Defined Network and Traditional Network
- Setup Web Server Over Docker Container in Linux
- Running GUI Applications on Docker in Linux
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.