pi-hole/pi-hole

Raspberry Pi 5 having trouble binding interfaces when using NetworkManager

p1r473 opened this issue · 1 comments

Versions

Pi-hole version is v5.17.3 (Latest: N/A)
web version is v5.21 (Latest: N/A)
FTL version is v5.24 (Latest: N/A)

Platform

  • OS and version: Bookworm
  • Platform: Raspberry Pi

Expected behavior

PiHole should bind to 127.0.0.1#53 and not try to bind to other addresses

Actual behavior / bug

PiHole is trying to bind to multiple addresses

Feb 11 17:52:38 X pihole-FTL[2301]: [2024-02-11 17:52:38.592 2301M] listening on 192.168.1.188 port 53
Feb 11 17:52:38 X pihole-FTL[2301]: [2024-02-11 17:52:38.592 2301M] listening on eth0(#2): 192.168.1.188 port 53
Feb 11 17:52:38 X pihole-FTL[2301]: [2024-02-11 17:52:38.593 2301M] listening on 127.0.0.3 port 53
Feb 11 17:52:38 X pihole-FTL[2301]: [2024-02-11 17:52:38.593 2301M] listening on lo(#1): 127.0.0.3 port 53
Feb 11 17:52:38 X pihole-FTL[2301]: [2024-02-11 17:52:38.593 2301M] FATAL ERROR in dnsmasq core: failed to create listening socket for 127.0.0.2: Address already in use

Steps to reproduce

Steps to reproduce the behavior:

  1. Drop in my working config from my Pi 4 (just upgraded to Pi 5)
  2. pihole -r
  3. pihole restartdns
  4. tail syslog
  5. view Pihole tryng to bind to other addresses

Debug Token

https://tricorder.pi-hole.net/vwYH3Kcc/

Additional context

Hey all, thanks for viewing my issue. I've had a pretty advanced PiHole config working for many years on my Pi 4 using dhcpcd. Today I am setting up my new Pi 5 using Networkmanager and Im having trouble getting Pihole to bind only to 127.0.0.1#53
My setup is:
pihole on 127.0.0.1#53 with unbound upstream 127.0.0.2#53 and upstream cloudflared 127.0.0.3#53 (i havent set up cloudflared yet on new installation)

Pihole should be listening only on 127.0.0.1#53
01-pihole.conf:

interface=eth0
listen-address=127.0.0.1
port=53
bind-interfaces
server=127.0.0.2#53

setupVars.conf:

PIHOLE_INTERFACE=eth0
IPV4_ADDRESS=192.168.1.188/24
DNSMASQ_LISTENING=single
PIHOLE_DNS_1=127.0.0.2#53
PIHOLE_DNS_2=127.0.0.3#53

However, when tailing the logs, its trying to bind all over the place:

 Successfully accessed setupVars.conf
Feb 11 17:59:21 X pihole-FTL[9128]: [2024-02-11 17:59:21.945 9128M] listening on 192.168.1.188 port 53
Feb 11 17:59:21 X pihole-FTL[9128]: [2024-02-11 17:59:21.945 9128M] listening on eth0(#2): 192.168.1.188 port 53
Feb 11 17:59:21 X pihole-FTL[9128]: [2024-02-11 17:59:21.946 9128M] listening on 127.0.0.3 port 53
Feb 11 17:59:21 X pihole-FTL[9128]: [2024-02-11 17:59:21.946 9128M] listening on lo(#1): 127.0.0.3 port 53
Feb 11 17:59:21 X pihole-FTL[9128]: [2024-02-11 17:59:21.946 9128M] FATAL ERROR in dnsmasq core: failed to create listening socket for 127.0.0.2: Address already in use

Unbound is the only thing supposed to listen on 127.0.0.2#53
unbound.conf:

interface: 127.0.0.2
port: 53

These config files worked fine on my Pi 4 using dhcpcd and Im having trouble figuring out why Pihole is trying to listen on other interfaces

ip addr:


1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet 127.0.0.2/32 scope host lo
       valid_lft forever preferred_lft forever
    inet 127.0.0.3/32 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host noprefixroute
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether d8:3a:dd:d5:49:9e brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.188/24 brd 192.168.1.255 scope global noprefixroute eth0
       valid_lft forever preferred_lft forever
    inet6 fd5a:3f13:c539:9680:891f:5271:31af:af60/64 scope global dynamic noprefixroute
       valid_lft 1717sec preferred_lft 1717sec
    inet6 fe80::436c:79c4:cefd:665b/64 scope link noprefixroute
       valid_lft forever preferred_lft forever

ifconfig:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.188  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::436c:79c4:cefd:665b  prefixlen 64  scopeid 0x20<link>
        inet6 fd5a:3f13:c539:9680:891f:5271:31af:af60  prefixlen 64  scopeid 0x0<global>
        ether d8:3a:dd:d5:49:9e  txqueuelen 1000  (Ethernet)
        RX packets 58699  bytes 11740872 (11.1 MiB)
        RX errors 0  dropped 2558  overruns 0  frame 0
        TX packets 4146  bytes 1162054 (1.1 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 107

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 946  bytes 77398 (75.5 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 946  bytes 77398 (75.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lsof -i -P -n | grep LISTEN | grep 53

unbound    881 unbound    4u  IPv4  13757      0t0  TCP 127.0.0.2:53 (LISTEN)

Other than using bookworm instead of bullseye, and pi 5 instead of pi4, the only thing different so far is using networkmanager over dhcpcd

I had to add

except-interface=lo
except-interface=wlan0

to /etc/dnsmasq.d/01-pihole.conf
This was not needed under dhcpcd

Problem solved!