I have the same issue. Loosing my mind TBH.
You responded to a 4 year old topic. I moved your post to a new thread.
Pleas explain your problem in detail an please upload a debug log and post just the token that is generated after the log is uploaded by running the following command from the Pi-hole host terminal:
pihole -d
or do it through the Web interface:
Tools > Generate Debug Log
I have a Pihole with a fixed IP, 192.168.0.3. It works, and I can get to the GUI interface with that IP.
Recently I noticed my router displaying alternating IP addresses for the Pi in its UI (the router lists clients by Mac).
I tried navigating to the second address on the same subnet and the Pihole GUI is served.
ip a
shows a bunch of stuff but here is eth0...
eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether xx:xx:eb:de:54:87 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.64/24 brd 192.168.0.255 scope global dynamic noprefixroute eth0
valid_lft 86015sec preferred_lft 86015sec
inet 192.168.0.3/24 brd 192.168.0.255 scope global secondary noprefixroute eth0
valid_lft forever preferred_lft forever
cat /etc/dhcpcd.conf
shows...
interface eth0
static ip_address=192.168.0.3/24
static routers=192.168.0.1
static domain_name_servers=127.0.0.1
Other notes...
- WiFi is disabled on the Pi
- I only have one DHCP server on the network
- The Pi DHCP server is disabled
- I have a docker container on the Pi serving HAAS
- I have a backup Pihole on the network fixed to 192.168.0.2, which doesn't have this issue
Note I fixed DHCP on my router to allocate .0.3 prior to running -d. I hope that doesn't confuse things.
Your debug log looks good.
Your Pi-hole listens on 192.168.0.3
and has been receiving queries via that address.
Yes but it's also getting an address from somewhere else. And it shouldn't be.
There are various ways of configuring static addresses, please check all of them.
Is there any output when you run
cat /etc/sysconfig/network
cat /etc/network/interfaces
cat /etc/netplan/*.yaml
cat /etc/sysconfig/network-scripts/*
OK thanks for the clues
No smoking guns?
pi@pihole03:~ $ cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
pi@pihole03:~ $ cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
pi@pihole03:~ $ cat /etc/netplan/*.yaml
cat: '/etc/netplan/*.yaml': No such file or directory
pi@pihole03:~ $ cat /etc/sysconfig/network-scripts/*
cat: '/etc/sysconfig/network-scripts/*': No such file or directory
pi@pihole03:~ $ cat /etc/network/interfaces.d
cat: /etc/network/interfaces.d: Is a directory
pi@pihole03:~ $ cd /etc/network/interfaces.d
pi@pihole03:/etc/network/interfaces.d $ ls
pi@pihole03:/etc/network/interfaces.d $
Is there anything in /etc/netplan
?
Do you have a directory /etc/NetworkManager
? If so, what are its contents?
pi@pihole03:~ $ cd /etc/netplan
-bash: cd: /etc/netplan: No such file or directory
pi@pihole03:~ $ cd /etc/NetworkManager
pi@pihole03:/etc/NetworkManager $ ls
conf.d dnsmasq.d NetworkManager.conf
dispatcher.d dnsmasq-shared.d system-connections
Sounds like you have two network managers active, NM(NetworkManager
) and dhcpcd5
, fighting over control.
With below ones you can see status for NM:
nmcli
sudo systemctl status NetworkManager
And with below one you can see what NM is all up to (log entries are rotated out over time so might need to restart NM first or reboot):
sudo journalctl -u NetworkManager
If want to disable NM:
sudo systemctl disable NetworkManager
Or might want to mask
it which is more radical:
sudo systemctl mask NetworkManager
Reboot and check with below if dhcpcd
is doing its job of assigning a static IP:
sudo journalctl -u dhcpcd
ip -br address show
Good observation. NetworkManager seems to be requesting an IP.
I disabled the fixed IP at the router and it got assigned .0.64 again, disabled NM it and rebooted. But couldn't ssh to either .0.3 or .0.64. I'll have to connect a monitor to further troubleshoot.
I looked through the terminal history before this and can't see any activity where I configured NM. It's possible I did some time ago troubleshooting HAAS docker, and because .0.3 was still addressable hadn't noticed.
Is NM part of Raspbian or do you have to install it separately?
No it isnt part of the default (EDIT:lite) image that you write to SD but can be installed by other software that depends on it:
pi@ph5b:~ $ apt policy network-manager
network-manager:
Installed: (none)
EDIT: Or maybe the desktop version comes with NM ... I dont know for sure
Pi-OS comes default installed with dhcpcd5
as a network manager/mangler and configured as a DHCP client OOTB.
The Pi-hole installer asks you about changing the dynamic DHCP IP into a static IP address and adding below section to below file to achieve that:
pi@ph5b:~ $ cat /etc/dhcpcd.conf
[..]
interface eth0
static ip_address=10.0.0.4/24
static routers=10.0.0.1
static domain_name_servers=10.0.0.1
That makes the Pi independent from DHCP or any MAC based reservations on the router.
Or should do
Check:
EDIT:
pi@ph5b:~ $ sudo journalctl -u dhcpcd
[..]
Jul 11 21:34:37 ph5b dhcpcd[11806]: eth0: using static address 10.0.0.4/24
Jul 11 21:34:37 ph5b dhcpcd[11806]: eth0: adding route to 10.0.0.0/24
Jul 11 21:34:37 ph5b dhcpcd[11806]: eth0: adding default route via 10.0.0.1
pi@pihole03:~ $ sudo journalctl -u dhcpcd
-- Logs begin at Mon 2021-07-12 13:55:27 NZST, end at Mon 2021-07-12 14:03:20 NZST. --
-- No entries --
Most likely she isnt running/"Active":
sudo systemctl status dhcpcd
If not, enable here:
sudo systemctl enable dhcpcd
Start here up:
sudo systemctl restart dhcpcd
Check journals again:
sudo journalctl -u dhcpcd
And check IP:
ip -br a
EDIT: ow ps. you still do have an interface
section at the bottom of the /etc/dhcpcd.conf
file do you?
If not, dhcpcd
will default try acquire an IP via DHCP again for all detected interfaces.
Thank you firends. All fixed I think.
sudo systemctl enable dhcpcd
followed by...
sudo systemctl disable NetworkManager
Seemed NM was the culprit.