Configure Avahi nss-mdns not to use local suffix with hostnames because of issue in mounting Samba share

8,678

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.

Share:
8,678

Related videos on Youtube

Espinosa
Author by

Espinosa

Updated on September 18, 2022

Comments

  • Espinosa
    Espinosa almost 2 years

    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?

  • Andy
    Andy about 12 years
    Recent versions of nss-mdns must be compiled with the non-default --enable-search-domains flag for it to honor this configuration.
  • Espinosa
    Espinosa about 12 years
    Sorry, it does not work :( Library 'libnss mdns' ignores "search local" in /etc/resolv.conf. See 0pointer.de/lennart/projects/nss-mdns. At least by default.
  • Espinosa
    Espinosa about 12 years
    serverfault.com/questions/356351/… - related. Summary is: Zeroconf != DNS.