I'm experiencing a problem connecting to hosts on my LAN via their hostname only when UFW is enabled.
When UFW is enabled:
ssh <machine>gives the message:ssh: Could not resolve hostname <machine>: Name or service not knownssh <machine-ip>connects just fine.ping <machine>gives the message:ping: <machine>: Name or service not knownping <machine-ip>works.
When UFW is disabled:
ssh <machine>connects just fine.ping <machine>works just fine.
If I lookup for hosts' names manually with nmap -sP 192.168.14.1/24 I can see all the hosts on my LAN with UFW enabled / disabled.
I read this question: "UFW is blocking DNS" and it's answers and I think it' irrelevant because UFW is not installed nor enabled on the remote machines I'm trying to connect to.
I allowed with ufw the app DNS as suggested by @rugk's answer and I also tried to do what the other answers proposed but it didn't help.
Do I need to manually enter the known hosts' IP addresses in /etc/hosts? I would prefer to avoid it because I'm using a laptop which isn't always connected to this specific network.