4

How to configure Avahi & nss-mdns to resolve names in my small home network in the same manner as Windows does with NetBIOS or more recently LLMNR.

For Linux, there are two options:

  • Winbind aka NetBIOS for linux, marked as DEPRECATED by many specialists
  • Avahi & nss-mdns - aka Zeroconf, MODERN, sounds good, I crave for similarities with LLMNR.

I gave try to Avahi.
It is already preconfigured in /etc/nsswitch.conf Instalation OK. Daemon runs, discovery runs, lookup - sort of.

But there is a problem.

ping foopc1
does not work - unknown host
ping foopc2.local
works!

I personally would not mind using "suffixed" names, but some systems do. Notably Samba. Mounting cifs network shares is not possible. Smb4k sees other computers nicely, but when attempted to mount a share (smb/cifs) it fails:
could not resolve address for foopc1

It seems that for samba client (mount.cifs) there must be match between network name accepted by hostname resolver (?) and name obtained by nmblookup (??) Please correct me if I'm wrong!

How to make a ping recognize my computers as foopc1 and foopc2 and NOT as foopc1.local and foopc2.local?

According to nss-mdns project homepage http://0pointer.de/lennart/projects/nss-mdns/ I created /etc/mdns.allow and put there just asterix:
*
..but to no avail.

I also tried to make network name aliases, to map:
foopc1.local -> foopc1
but /etc/hosts does not support this and there is no simple way to get around.

Excluded solutions:

  • editing /etc/hosts - keeping static mapping list is impractical in today's dynamic networks
  • local DNS - all computers are powered down frequently, no server like HW here
  • fiddling with wifi router setup, assigning fixed IP to MAC addresses etc. - let's imagine I don't have access to it
  • note: our wifi router does not have DNS server (common practice)
  • PLUS: a challenge to prove that Linux can do same things as Windows with the same user friendly way

See also Why can Windows machines resolve local names when Linux can't?

Espinosa
  • 151
  • 1
  • 6

1 Answers1

5

If you insert "search local" within the file /etc/resolv.conf, the queries will be send with the given domain for example host my-pc result in a first query for my-pc and a second for my-pc.local.

Lucas Kauffman
  • 16,818
  • 9
  • 57
  • 92
jjsa
  • 51
  • 1
  • 2
  • 1
    Recent versions of nss-mdns must be compiled with the non-default `--enable-search-domains` flag for it to honor this configuration. – Andy Apr 29 '12 at 18:01
  • Sorry, it does not work :( Library 'libnss mdns' ignores "search local" in /etc/resolv.conf. See http://0pointer.de/lennart/projects/nss-mdns/. At least by default. – Espinosa May 07 '12 at 15:14
  • http://serverfault.com/questions/356351/adding-search-to-resolv-conf-prevents-fqdn-searches - related. Summary is: Zeroconf != DNS. – Espinosa May 07 '12 at 15:18