{"id":15148423,"url":"https://github.com/magicdude4eva/piholecloudflared","last_synced_at":"2025-08-23T06:37:04.726Z","repository":{"id":168423800,"uuid":"139302422","full_name":"magicdude4eva/PiHoleCloudFlareD","owner":"magicdude4eva","description":"Raspberry Pi setup with Pi-Hole, CloudflareD, DHCP as the ultimate Ad-blocker","archived":false,"fork":false,"pushed_at":"2025-03-20T19:03:30.000Z","size":123,"stargazers_count":64,"open_issues_count":2,"forks_count":10,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-20T03:20:23.066Z","etag":null,"topics":["cloudflare","dhcp","dns","letsencrypt","pi-hole"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/magicdude4eva.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["magicdude4eva"],"custom":["https://www.paypal.com/paypalme/GerdNaschenweng","https://accounts.binance.com/register?ref=13896895","https://www.kucoin.com/ucenter/signup?rcode=7wrbxe","https://crypto.com/app/ref6ayzqvp","https://dex.plutus.it/auth/referee/signup?refId=BUihTI"]}},"created_at":"2018-07-01T05:17:45.000Z","updated_at":"2025-04-10T08:56:57.000Z","dependencies_parsed_at":"2024-02-29T21:31:57.685Z","dependency_job_id":"c8ff779c-864d-480c-84f0-7a2accccc511","html_url":"https://github.com/magicdude4eva/PiHoleCloudFlareD","commit_stats":null,"previous_names":["magicdude4eva/piholecloudflared"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/magicdude4eva/PiHoleCloudFlareD","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicdude4eva%2FPiHoleCloudFlareD","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicdude4eva%2FPiHoleCloudFlareD/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicdude4eva%2FPiHoleCloudFlareD/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicdude4eva%2FPiHoleCloudFlareD/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/magicdude4eva","download_url":"https://codeload.github.com/magicdude4eva/PiHoleCloudFlareD/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicdude4eva%2FPiHoleCloudFlareD/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271745679,"owners_count":24813521,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-23T02:00:09.327Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloudflare","dhcp","dns","letsencrypt","pi-hole"],"created_at":"2024-09-26T13:03:43.523Z","updated_at":"2025-08-23T06:37:04.705Z","avatar_url":"https://github.com/magicdude4eva.png","language":"Shell","funding_links":["https://github.com/sponsors/magicdude4eva","https://www.paypal.com/paypalme/GerdNaschenweng","https://accounts.binance.com/register?ref=13896895","https://www.kucoin.com/ucenter/signup?rcode=7wrbxe","https://crypto.com/app/ref6ayzqvp","https://dex.plutus.it/auth/referee/signup?refId=BUihTI","https://paypal.me/GerdNaschenweng"],"categories":[],"sub_categories":[],"readme":"[paypal]: https://paypal.me/GerdNaschenweng\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://pi-hole.net\"\u003e\u003cimg src=\"https://pi-hole.github.io/graphics/Vortex/Vortex_with_text.png\" width=\"150\" height=\"255\" alt=\"Pi-hole\"\u003e\u003c/a\u003e\u003cbr/\u003e\n\u003cb\u003eTutorial to install a Network-wide ad blocking, DNS- and DHCP server on Raspberry Pi\u003c/b\u003e\u003cbr/\u003e\n\u003c/p\u003e\n\n___\n![paypal](https://img.shields.io/badge/PayPal--ffffff.svg?style=social\u0026logo=data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8%2F9hAAAABHNCSVQICAgIfAhkiAAAAZZJREFUOI3Fkb1PFFEUxX%2F3zcAMswFCw0KQr1BZSKUQYijMFibGkhj9D4zYYAuU0NtZSIiNzRZGamqD%2BhdoJR%2FGhBCTHZ11Pt%2B1GIiEnY0hFNzkFu%2FmnHPPPQ%2Buu%2BTiYGjy0ZPa5N1t0SI5m6mITeP4%2B%2FGP%2Fbccvto8j3cuCsQTSy%2FCzLkdxqkXpoUXJoUXJrkfFTLMwHiDYLrFz897Z3jT6ckdBwsiYDMo0tNOIGuBqS%2Beh7sdAkU2g%2BkBFGkd%2FrtSgD8Z%2BrBxj68MAGG1A9efRhVsXrKMU7Y4cNyGOwtDU28OtrqdUMetldvzFKxCYSHJ4NsJ%2BnRJGexHba7VJ%2FTff4BaQFBjVcbqIEZ1bESYn4PRUcHx2N952awUkOHZedUcWm14%2FtjqjREHawUEsgx6Ajg5%2Bsi7jWqBwA%2BmIrXlo9YHUVTmEP%2F6hOO1Ofiyy3pjo%2BsvBDX%2FZpSakhz4BqvQDvdYvrXQEXZViI5rPpBEOwR2l16vtN7bd9SN3L1WXj%2BjGSnN38rq%2B7VL8xXQOdDF%2F0KvXn8BlbuY%2FvUAHysAAAAASUVORK5CYII%3D)\n:beer: **Please support me**: Although all my software is free, it is always appreciated if you can support my efforts on Github with a [contribution via Paypal][paypal] - this allows me to write cool projects like this in my personal time and hopefully help you or your business. \n___\n\nThe Pi-hole is a [DNS sinkhole](https://en.wikipedia.org/wiki/DNS_Sinkhole) that protects your devices from unwanted content, without installing any client-side software.\n\n- **Easy-to-install**: our versatile installer walks you through the process, and [takes less than ten minutes](https://www.youtube.com/watch?v=vKWjx1AQYgs)\n- **Resolute**: content is blocked in _non-browser locations_, such as ad-laden mobile apps and smart TVs\n- **Responsive**: seamlessly speeds up the feel of everyday browsing by caching DNS queries\n- **Lightweight**: runs smoothly with [minimal hardware and software requirements](https://discourse.pi-hole.net/t/hardware-software-requirements/273)\n- **Robust**: a command line interface that is quality assured for interoperability\n- **Insightful**: a beautiful responsive Web Interface dashboard to view and control your Pi-hole\n- **Versatile**: can optionally function as a [DHCP server](https://discourse.pi-hole.net/t/how-do-i-use-pi-holes-built-in-dhcp-server-and-why-would-i-want-to/3026), ensuring *all* your devices are protected automatically\n- **Scalable**: [capable of handling hundreds of millions of queries](https://pi-hole.net/2017/05/24/how-much-traffic-can-pi-hole-handle/) when installed on server-grade hardware\n- **Modern**: blocks ads over both IPv4 and IPv6\n- **Free**: open source software which helps ensure _you_ are the sole person in control of your privacy\n\n## Setup the Raspberry Pi\nFor all my home-network projects I run [Raspbian Debian Stretch Lite](https://www.raspberrypi.org/downloads/raspbian/). The setup is trivial:\n- Get yourself a Raspberry Pi and a SD-card\n- Use [Etcher](https://etcher.io/) to format and SD-card\n\n### Upgrade packages and distribution\n```\nsudo apt-get update \u0026\u0026 sudo apt-get upgrade\nsudo apt-get dist-upgrade\n\n```\n\n### Upgrade firmware\n```\nsudo raspi-config\nsudo rpi-update\n```\n\n### Install my custom MOTD\nThis changes the login screen. Just copy it from this repository\n```\nsudo cp ~/motd.sh /etc/profile.d/motd.sh\nsudo chown root:root /etc/profile.d/motd.sh\nsudo chmod +x /etc/profile.d/motd.sh\nsudo rm /etc/motd\n```\n\nUse `sudo nano /etc/ssh/sshd_config` to change to `PrintLastLog no`\n\n### Enable root login\n- Set a root password via `sudo passwd root`\n- Edit `sudo vi /etc/ssh/sshd_config` and set `PermitRootLogin yes`\n- Restart SSHD `/etc/init.d/ssh restart`\n\n### Enable password-less login\n- Create the .ssh directory via `install -d -m 700 ~/.ssh`\n- Create a SSH key on your PC: `ssh-keygen -t rsa -b 4096 -C \"your_email@example.com\"`\n- Install your public key for user 'pi' `cat ~/.ssh/id_rsa.pub | ssh pi@IPADDRESS 'cat \u003e\u003e .ssh/authorized_keys'`\n- Install your public key for user 'root' `cat ~/.ssh/id_rsa.pub | ssh root@IPADDRESS 'cat \u003e\u003e .ssh/authorized_keys'`\n\n### Cleanup \u0026 Install extra tools\n```\nsudo apt-get install -y sysstat vnstat screen\nsudo apt-get purge apache2\nsudo apt-get autoremove \n```\n\n### Enable NTP time\n```\ntimedatectl set-ntp true \ntimedatectl status\n\n# Time will be in GMT/UTC, if you want to adjust, use the following:\necho \"Africa/Johannesburg\" | sudo tee /etc/timezone\nsudo dpkg-reconfigure --frontend noninteractive tzdata\ntimedatectl set-timezone Africa/Johannesburg\n```\nReboot your Pi before continuing the next step. Login as 'root' to complete the next steps.\n\n## Install Cloudflare DNS\nWe will use Cloudflare via [Argo Tunnel](https://developers.cloudflare.com/argo-tunnel/quickstart/) as our DNS provider \n```\ncd ~\nwget https://bin.equinox.io/c/VdrWdbjqyF/cloudflared-stable-linux-arm.tgz\nmkdir argo-tunnel\ntar -xvzf cloudflared-stable-linux-arm.tgz -C ./argo-tunnel\nrm cloudflared-stable-linux-arm.tgz\ncd argo-tunnel\n./cloudflared --version\n```\n\nTo manually test it, run:\n```\nsudo ./cloudflared proxy-dns --port 54 --upstream https://1.1.1.1/.well-known/dns-query --upstream https://1.0.0.1/.well-known/dns-query\n```\n\nLet's install it as a system service by copying the [service file](https://github.com/magicdude4eva/PiHoleCloudFlareD/blob/master/etc/systemd/system/dnsproxy.service) and then starting it via `sudo systemctl restart dnsproxy.service`\n\n## Install email for notifications\nWe will use `msmtp` for this and I use my Google Apps account to send out email:\n```\napt-get install msmtp ca-certificates mailutils\nrm /usr/sbin/sendmail\nln -s /usr/bin/msmtp /usr/sbin/sendmail\n```\n\nAdjust [`/etc/msmtprc`](https://github.com/magicdude4eva/PiHoleCloudFlareD/blob/master/etc/msmtprc) and [`/etc/msmtprc.aliases`](https://github.com/magicdude4eva/PiHoleCloudFlareD/blob/master/etc/msmtprc.aliases) accordingly.\n\n## Install PiHole\nThis is really a one-liner via `curl -sSL https://install.pi-hole.net | bash`\n\n### Adjust PiHole configuration files\n1) Adjust [`sudo nano /etc/pihole/setupVars.conf`](https://github.com/magicdude4eva/PiHoleCloudFlareD/blob/master/etc/pihole/setupVars.conf)\n- The `IPV4_ADDRESS` to the IP of your Pi\n- Comment out `PIHOLE_DNS_1` and `PIHOLE_DNS_2`\n- Enable `DHCP_ACTIVE` and DHCP settings\n- Adjust the `PIHOLE_DOMAIN`\n\n2) Copy my [whitelist.txt](https://github.com/magicdude4eva/PiHoleCloudFlareD/blob/master/etc/pihole/whitelist.txt)\n\n3) Adjust [`/etc/dnsmasq.d/`](https://github.com/magicdude4eva/PiHoleCloudFlareD/tree/master/etc/dnsmasq.d)\n- In [`01-pihole.conf`](https://github.com/magicdude4eva/PiHoleCloudFlareD/blob/master/etc/dnsmasq.d/01-pihole.conf) comment out `server` and adjust `server=127.0.0.1#54` so that it points to the local Cloudflare tunnel\n- Adjust [`02-pihole-dhcp.conf`](https://github.com/magicdude4eva/PiHoleCloudFlareD/blob/master/etc/dnsmasq.d/02-pihole-dhcp.conf) to match your IP-range\n- Adjust [`04-pihole-static-dhcp.conf`](https://github.com/magicdude4eva/PiHoleCloudFlareD/blob/master/etc/dnsmasq.d/04-pihole-static-dhcp.conf) to setup static IPs\n\n4) Adjust [`/etc/hosts`](https://github.com/magicdude4eva/PiHoleCloudFlareD/blob/master/etc/hosts) to setup other hosts which should be resolved in your network\n\n### Install SSL via Let's Encrypt\nI am using DNS-01 authentication via Cloudflare DNS with acme.sh - this allows me to automatically renew SSL certificates without exposing services to the outside. Run the below as 'root'-user:\n\n1) Install acme.sh `curl https://get.acme.sh | sh`\n2) Register with Let's Encrypt `acme.sh --upgrade --auto-upgrade --accountemail \"youremail\"`\n3) Export your Cloudflare API-key and email:\n```\nexport CF_Key=\"YOUR-API-KEY\"\nexport CF_Email=\"YOUR-CLOUDFLARE-EMAIL\"\n```\n\n4) Adjust your [`/etc/lighthttpd/external.conf`](https://github.com/magicdude4eva/PiHoleCloudFlareD/blob/master/etc/lighttpd/external.conf) (change `pihole.example.com` to your own domain name)\n\n5) Issue your certificate and adjust the domain `pihole.example.com` according to your own settings\n```\nacme.sh --force --issue  --dnssleep 30 --dns dns_cf -d pihole.example.com  --reloadcmd \"cat /root/.acme.sh/pihole.example.com/pihole.example.com.key /root/.acme.sh/pihole.example.com/pihole.example.com.cer | tee /root/.acme.sh/pihole.example.com/pihole.example.com.combined.pem \u0026\u0026 systemctl restart lighttpd.service\"\n```\n\nYou are done - just reboot one more time and you should be able to access Pi-Hole via `https://pihole.example.com`\n\n\n## Post-install: Make your network take advantage of Pi-hole\nOnce you have completed the above steps, you will need to [configure your router to have **DHCP clients use Pi-hole as their DNS server**](https://discourse.pi-hole.net/t/how-do-i-configure-my-devices-to-use-pi-hole-as-their-dns-server/245) which ensures that all devices connecting to your network will have content blocked without any further intervention.\n\nIf your router does not support setting the DNS server, you can [use Pi-hole's built in DHCP server](https://discourse.pi-hole.net/t/how-do-i-use-pi-holes-built-in-dhcp-server-and-why-would-i-want-to/3026); just be sure to disable DHCP on your router first (if it has that feature available).\n\nAs a last resort, you can always manually set each device to use Pi-hole as their DNS server.\n\n-----\n\n\n\n## Donations are always welcome\n\n[paypal]: https://paypal.me/GerdNaschenweng\n\n🍻 **Support my work**  \nAll my software is free and built in my personal time. If it helps you or your business, please consider a small donation via [PayPal][paypal] — it keeps the coffee ☕ and ideas flowing!\n\n💸 **Crypto Donations**  \nYou can also send crypto to one of the addresses below:\n\n```\n(CRO)   0xb83c3Fe378F5224fAdD7a0f8a7dD33a6C96C422C (Cronos)  \n(USDC)  0xb83c3Fe378F5224fAdD7a0f8a7dD33a6C96C422C (ERC20)  \n(ETH)   0xfc316ba7d8dc325250f1adfafafc320ad75d87c0  \n(BNB)   0xfc316ba7d8dc325250f1adfafafc320ad75d87c0\n(BTC)   bc1q24fuw84l6whm20umlr56nvqjn908sec8pavk3z  \nCrypto.com PayString: magicdude$paystring.crypto.com\n```\n\n🧾 **Recommended Platforms**  \n- 👉 [Curve.com](https://www.curve.com/join#DWPXKG6E): Add your Crypto.com card to Apple Pay  \n- 🔐 [Crypto.com](https://crypto.com/app/ref6ayzqvp): Stake and get your free Crypto Visa card  \n- 📈 [Binance](https://accounts.binance.com/register?ref=13896895): Trade altcoins easily","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagicdude4eva%2Fpiholecloudflared","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagicdude4eva%2Fpiholecloudflared","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagicdude4eva%2Fpiholecloudflared/lists"}