Resolving smb server names in Linux

Windows handles NETBIOS server names just like any other DNS entry, so you can ping, http:// or ftp to any computer on your Windows network. While Linux binds those computers also via Samba, it does not export that information to the rest of the networking stack, i.e. this will fail:

ping win7machine

This post [1] has a nice and short explanation of how to get it done:

1. edit /etc/nsswitch.conf
2. find the line starting with “hosts”
3. append “wins” to that line
4. reboot and wait (name resolution takes some time)

On my machine the line looks like this:

hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4 wins

A post comment said that the package winbind needed to be installed, for me it worked without that.

Update 2011.10.14 With Ubuntu 11.10 I also needed winbind

sudo apt-get install winbind

Update 2014.12.15 And with 14.04 you also need to install libnss-winbind:

sudo apt-get install libnss-winbind

Resources
 
[1] ping netbios names from linux (samba)
http://www.linuxquestions.org/questions/linux-networking-3/ping-netbios-names-from-linux-samba-271336/

[2] Windows hostnames are not resolved
http://askubuntu.com/questions/93302/windows-hostnames-are-not-resolved

2 thoughts on “Resolving smb server names in Linux

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s