Adam SMASH!

Netbios name resolution in Ubuntu

by Adam on Feb.11, 2010, under Linux, Ubuntu 9.04

I was having a fit earlier this week trying to figure out why I cannot ping the other PCs in my network by their netbios names. I could ping my linux box from my Windows 7 PC, but not the other way around. So after two days of googling and trying different config options I found out what it takes.

I’m not sure if Ubuntu just cannot do this on it’s own, or if just my particular install is unable, but my ubuntu 9.04 install had no ability to ping machines by their netbios names. This is what I had to do to get that working.

First of all you need to edit the /etc/nsswitch.conf file. As far as I’ve been able to tell, this is the file that Ubuntu uses to determine the host name resolution order when trying to resolve a host name to an IP address.

sudo nano /etc/nsswitch.conf

The line you need to edit is the Hosts: line. Mine looked like this previously:

hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4

We need to add something there after files. What we need to add is wins.

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

I would recommend against adding or removing anything else in this line, it may cause youre entire system to stop functioning, no joke. I think Ubuntu might rely on this file to get the local loopback device going, which tons of stuff depends on.

Anyhow, after adding wins to that line, we are only halfway there. We need to install some additional software from the repositories.

sudo apt-get install winbind

Once you have winbind installed and the wins attribute added to the hosts line of the nsswitch.conf file, you should have no problems pinging machines on your network by their netbios host name.

protip: for an app that will list the computers on your network that are broadcasting a netbios name, also install nbtscan.


2 Comments for this entry

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...