Pihole standalone install: Difference between revisions

From wikinotes
Line 61: Line 61:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
tail -f /run/log/pihole/pihole.log
tail -f /run/log/pihole/pihole.log # lists nameservers, hosts, interfaces ...
 
# confirm server is listening
netstat -ln46 | grep :53
 
# confirm there is a route for DNS queries to be performed
netstat -r  # show routing table


# test DNS resolution
# test DNS resolution

Revision as of 18:04, 11 October 2021

Archlinux

NOTE:

I haven't been successful with this yet...

Install

pacaur -S pi-hole-standalone
sudo systemctl start pi-hole-gravity.timer
sudo journalctl -f -u pi-hole-gravity.timer  # wait approx 1min for update
# alternatively
/usr/bin/pihole updateGravity

Free port 53

You'll also need to start pihole-FTL.service, which listens on port 53.
If this port is already occupied, you'll need to free it.

# is port 53 in use?
netstat -an | grep ':53'

# try identifying program using it
lsof -i :53

systemd-resolvd


systemd-resolved.service may be using port-53.
If this is the case, disable the stub listener.

# /etc/systemd/resolved.conf

[Resolve]
DNSStubListener=no

DNS with pihole

Configure your network manager so that it uses 127.0.0.1 as it's DNS server.

NOTE:

Before changing your nameserver, be sure to test queries using host google.com 127.0.0.1.
If this does not work, apparently your router may have rebind protection enabled.

troubleshooting


tail -f /run/log/pihole/pihole.log  # lists nameservers, hosts, interfaces ...

# confirm server is listening
netstat -ln46 | grep :53

# confirm there is a route for DNS queries to be performed
netstat -r  # show routing table

# test DNS resolution
host google.com 127.0.0.1       # with 'host'
drill @127.0.0.1 A google.com   # with 'drill'


NetworkManager


NetworkManager also runs an instance of dnsmasq.
You'll need to disable it to use pi-hole.

# /etc/NetworkManager/NetworkManager.conf

[Main]
dns=none

Configure NetworkManager to use pihole.

nmcli con  # list all connections
nmcli con mod <connectionName> ipv4.dns "127.0.0.1"
nmcli con mod <connectionName> ipv4.ignore-auto-dns yes
sudo systemctl restart NetworkManager.service


netctl

todo


Confirm Working

pihole status         # confirm pihole DNS is started
cat /etc/resolv.conf  # only nameserver should be 127.0.0.1