Warning in dnsmasq core: not giving name mediaputer.lan to the DHCP lease of 192.168.0.202 because the name exists in /etc/hosts with address 127.0.1.1
I spent some time trying to figure out why this error kept appearing in my Pi.Hole logs. Everything otherwise seemed to be working. The "mediaputer.lan" device is the Pi 400 I use to run Pi.Hole and DHCP. It has a static IP address set by my main router: 192.168.0.200. I tried editing /etc/hosts with that IP, then tried setting the same static IP address within Pi.Hole itself.
After seeking online solutions, I ran
ip r | grep default.
The results showed something that perhaps a smarter individual would've already guessed:
default via 192.168.0.1 dev eth0 src 192.168.0.200 metric 202 default via 192.168.0.1 dev wlan0 proto dhcp src 192.168.0.202 metric 303
The Pi is connected over Ethernet but still has wireless radio enabled and that wireless interface will get its own IP address. While wifi could be useful if the ethernet cable one day had an issue, that seems unlikely and it's also a problem I would want to notice and fix immediately. I believe it's good security practice to disable any unused radio signals, and the less wireless interference I create in my own home, the better.
So next I edited /boot/config.txt:
sudo nano /boot/config.txt
Inserted these lines after [all]:
# lines below will disable wifi and bluetooth dtoverlay=disable-wifi dtoverlay=disable-bt
And there we go, a reboot should be all we need!
sudo shutdown -r
Well, it looks like that worked to shut down wifi as far as the Pi is concerned, but the message kept appearing in the log files of the Pi.Hole. The Pi computer itself is named mediaputer but the hostname of the Pi.Hole is pi.hole. I'm no network expert but I specialize in throwing spaghetti at the wall, so next I dove back into /etc/hosts:
sudo nano /etc/hosts
The line at the top of the file is
127.0.0.1 localhost, which is accurate—but then why does the bottom line have 127.0.1.1 mapped to mediaputer, when mediaputer should be equal to localhost which is equal to 127.0.0.1? So I guess you could say I had a hunch.
Let's instead map that 127.0.1.1 to the pi.hole. Here's what the file looked like now:
127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters 127.0.1.1 pi.hole
Rebooted, and so far there's no more error. There's a slight chance I could've been the one to incorrectly modify the hosts file in the past since I didn't see anyone else on the Internet with this particular solution, but at least it motivated me to create my first post.