Mounting cifs share in Ubuntu using NetBios name, not IP address
System-wide NBNS support is not a standard part of Ubuntu (or most other Linux systems). The reason nmblookup
works is because it generates and and receives NBNS packets on its own, while all other tools (including mount.cifs
) rely on the global "resolve hostname" function to pick the right protocol.
The hostname lookup module for NBNS is called libnss_wins.so.2
, usually packaged either as libnss-winbind or just part of smbclient. Once installed, Debian and Ubuntu will automatically activate it, otherwise it needs to be added to the "hosts" line of /etc/nsswitch.conf
:
- hosts: files dns
+ hosts: files dns wins
To work, the module needs winbindd to be running. (I think previously it used to work standalone, or just with nmbd running, but apparently not anymore.)
Test with:
-
getent ahosts ComputerName
for all active modules (those listed in nsswitch.conf), -
getent -s wins ahosts ComputerName
for the wins module specifically (whether active or not).