Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

Fedora 33 nslookup works but ping does not

On my shiny new upgraded Fedora 33 desktop, I was unable to connect to my ssh server vm3.ipa.example.com. Of course my vm environment uses dhcp and I know I've had some dynamic dns update problems, and I just rebooted my dns servers, so maybe something was amiss. I logged in to the console of the vm (virsh console vm3) and made sure the system had the IP address I expected. Nslookup works, and shows me the same IP address. So why does ssh show "hostname not found"? The answer is: systemd-resolved had taken control of /etc/resolv.conf and made it a symlink to ../run/systemd/resolve/resolv.conf which obviously is not what I want. So, I unlinked the file, made the real resolv.conf, and also threw in a bonus:

sudo unlink /etc/resolv.conf
echo "nameserver 192.168.1.1" | sudo tee /etc/resolv.conf
echo "nameserver 192.168.1.2" | sudo tee /etc/resolv.conf
echo "search ipa.example.com example.com" | sudo tee /etc/resolv.conf
sudo chattr +i /etc/resolv.conf

And then for good measure I disabled and masked systemd-resolved.

sudo systemctl disable --now systemd-resolved.service
sudo systemctl mask systemd-resolved.service

Don't let Systemd ruin your networking!

Comments