Candid photograph of a Linux server terminal with a soft olive-green glow against a dark slate background, conveying a calm technical atmosphere.

Step-by-step guides for system administrators — covering command-line basics, web server setup, and preparation material for technical interviews.

Browse Tutorials

Setting Up a Pi-Hole DNS Sinkhole on CentOS

Pi-hole turns a spare CentOS system into a network-wide DNS filter. Queries for advertising and tracking domains are answered locally, giving households or small offices greater control over name resolution. Here, sinkhole means DNS filtering rather than a malware command-and-control trap.

This guide uses CentOS Stream 9 and assumes a wired LAN host with sudo access. CentOS Linux 7 reached end of life in June 2024, so use it only for legacy work and plan an upgrade rather than exposing an unsupported server.

Australian networks make the routing details especially important. NBN fibre is common around Sydney, Melbourne and Brisbane, while regional premises may use fixed wireless or older connections; each supplied gateway handles DHCP and DNS differently.

Plan for a stable private address, a browser on the LAN, and backups of Pi-hole's settings and query database. The aim is a reliable resolver, not a decorative box that quietly bypasses filtering whenever DNS fails.

Preparing the CentOS host

Give the server a clear hostname with sudo hostnamectl set-hostname pihole, then record its interface name and MAC address with ip link. Reserve an address outside the router's DHCP pool, or set it statically in NetworkManager; never let two devices claim the same IP.

Before installing, check port 53 with sudo ss -lntup | grep ':53'. A listener on 127.0.0.53 usually belongs to systemd-resolved and can conflict with Pi-hole. Keep a working upstream address in the NetworkManager profile so package access does not disappear with the host resolver.

Installing Pi-Hole cleanly

Install prerequisites with sudo dnf install -y curl bind-utils, then use the official Pi-hole installer and its documented curl pipeline into sudo bash. The interactive setup installs FTL and asks which upstream resolver and blocklists to use.

For an Australian household, 1.1.1.1 and 9.9.9.9 are convenient public upstreams, although some workplaces prefer their own resolver. Confirm pihole status reports FTL as running, open the /admin path on the server's LAN address, and change the default password before wider use.

Configuring DNS and firewall access

Set the upstream addresses in Pi-hole's DNS settings or /etc/pihole/ftl.conf with DNS_SERVERS=1.1.1.1,9.9.9.9, then restart FTL. Avoid a loop: if the router sends clients to Pi-hole, Pi-hole must not send its own queries back to that router's DNS service.

Restrict UDP and TCP port 53 with firewalld rich rules, replacing the example subnet with your own. For example: sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.1.0/24" port port="53" protocol="udp" accept'. Repeat it for TCP, then run sudo firewall-cmd --reload.

Connecting Australian home networks

On the router, set DHCP's DNS server option to the Pi-hole address and reserve that address for the server's MAC. This applies with NBN gateways from Telstra or Optus and routers from TPG, iiNet or Aussie Broadband. Double NAT is harmless because clients only need local reachability.

An Edimax range extender can help reach the gateway's administration page from a home office; the browser-based Edimax setup explains the join process. If the router advertises IPv6 DNS, give Pi-hole a stable IPv6 address and configure FTL to listen on it, or remove that advertisement. Otherwise, clients may bypass the IPv4 sinkhole.

Verifying filtering and DNS behaviour

Test locally with dig @127.0.0.1 example.com, then query the LAN address from a laptop or phone with dig @192.168.1.10 pi-hole.net. Use the actual address assigned to the server and confirm that replies come from Pi-hole rather than the ISP resolver.

Watch FTL with sudo pihole -t, and check the admin Query Log for blocked domains. A blocked query should normally return a null address such as 0.0.0.0. Clear the DNS cache on one client after changing the router settings so that the new resolver is used.

Hardening administration access

The web interface controls queries, blocklists and DNS behaviour, so it should not be exposed to the internet. The same discipline used for other Linux panels is shown in the Fedora phpMyAdmin walkthrough: bind services narrowly, protect transport and limit administrative paths.

Keep the panel on the trusted LAN, use an SSH tunnel for occasional remote access, and avoid router port forwarding. A managed Australian office may call the DNS cutover an “arvo” change, meaning an afternoon change; a pre-agreed morning window avoids a rush and gives staff time to report issues.

Keeping the sinkhole reliable

Maintain Pi-hole with sudo pihole -up, apply CentOS updates with sudo dnf update, and back up /etc/pihole plus /var/lib/pihole/pihole-FTL.db. Test the restore path; a backup that has never been restored is merely an untested assumption.

Set the clock zone with timedatectl set-timezone Australia/Sydney; Melbourne changes for daylight saving, while Brisbane does not. Monitor FTL, free disk space and cron-based gravity updates. The Linuxtpoint guides provide related CentOS maintenance material. The point to remember is simple: keep Pi-hole on a stable address, make it the only advertised DNS path, test IPv4 and IPv6, and restrict its administration interface.