I have a Pi 1 B running dnsmasq as name server for my home network. This setup works great for me and has been much more stable than letting my Asus router handle it.
Lately – however – I have noticed a problem: The pi can't resolve its own hostname unless I specify the full domain.
$ ping pihostname ping: unknown host pihostname $ ping pihostname.mydomain.lan PING pihostname.mydomain.lan (xxx.xxx.xxx.xxx) 56(84) bytes of data.
It can find other computers on the network without the domain (but the domain is not expanded):
$ ping otherhostname PING otherhostname (xxx.xxx.xxx.xxx) 56(84) bytes of data. $ ping otherhostname.mydomain.lan PING otherhostname.mydomain.lan (xxx.xxx.xxx.xxx) 56(84) bytes of data.
Other computers can find the pi without the domain (and here the domain is expanded):
$ ping pihostname PING pihostname.mydomain.lan (xxx.xxx.xxx.xxx): 56 data bytes
This leads to an error message every time I use the sudo command on the pi:
$ sudo echo hello sudo: unable to resolve host pihostname [sudo] password for myusername: hello
Any tips on how to debug this?