ubuntu server not resolving LAN hostnames
About your current output
ping wstation
PING wstation.local.domain
Clearly indicates that your pc is appending .local.domain
to non-FQDN queries. This is something configured improperly or at least wrong in your set up. (unless you actually use the .local.domain
suffix on purpose)
Name resolving and periods
One important thing what a lot of people don't know, is that a full name should always end with a period (.
). If you omit it, then the machine will try to resolve it within the local search domain (e.g. mydomain.tld). So in that case, a query for mypc.local
would become mypc.local.mydomain.tld
. To prevent this, query with the period.
Resolver configuration
The resolver configuration is of great importance here. In Ubuntu (and Debian) this is configured in the file /etc/network/interfaces
(assuming you're not running NetworkManager):
iface eth0 inet static
address 192.168.3.3
netmask 255.255.255.0
gateway 192.168.3.1
dns-nameservers 192.168.3.45 192.168.8.10
dns-search foo.org bar.com # <-- these are the search domains
Name resolving in Linux can also be accomplished in other ways. It's not just that the local DNS server is being queried for all of this. Take a look at your /etc/nsswitch.conf
file for the hosts
configuration of resolving:
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
This means that files are tried first (this is the /etc/hosts
file), then mDNS and only later the real DNS server is queried. mDNS is implemented using Avahi in Linux and is called Bonjour on Apple devices. It is using the .local
suffix by default and works via broadcast messages. Much like ARP works, but then for DNS.
All these systems can be very confusing and even more when using .local
in a regular DNS setup mixed with mDNS devices. I guess this is why you're confused now as to why one device works and the other doesn't: they're not all using the same resolving method.
To sort things out
- Avoid the use if
.local
unless you want to rely on mDNS completely. From your question I understand you'd like to keep things configured yourself in a central place, so my approach here is to avoid it. - Configure your local DNS server (the DD-WRT device in your case) to use a special domain name, e.g.
my.home
. For dnsmasq this is a single setting, but in regular setups this should be configured on both the DNS server as well as the DHCP server (as it's being announced via DHCP). - Configure all PCs to have a simple and unique host name. They use this in their request for DHCP and this is used in the dnsmasq running on your router to resolve them. Alternatively, configure them manually to not to have to rely on DHCP.
- Remove any leftover configuration in
/etc/resolv.conf
in case you fiddled with it in the past. Configure the PCs in your network to use
my.home
as the local search domain. This can be done via DHCP automatically, or if using static addresses via the/etc/network/interfaces
file or in Network Manager:- Now both simple name resolving (
ping hostname
) as well as full name (ping hostname.my.home
) should work.