When I ping any local windows hostname from my Ubuntu machine I get "unable to resolve host", but when I ping from a windows machine it works fine. Why would this be? Samba & Miredo are installed
To ping a netbios name in Ubuntu you need to add
gksu gedit /etc/nsswitch.conf
wins to the line:
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
So it looks like this:
hosts: files mdns4_minimal [NOTFOUND=return] dns wins mdns4
Save the file, close the text editor, and ping away.
If that does not work, open
/etc/samba/smb.conf, and uncomment the "name resolve order" line:
name resolve order = wins lmhosts bcast
after that, restart
nmbd smbd winbindd.
4I added wins but that didn't change anything. However, I noticed that if I add ".local" after some names it works (with or without the wins setting)... Do you know what's going on there?– DavidFeb 24, 2011 at 5:38
plus in addition to nejode's answer (thanks nejode) I would also check your smb.conf I have added mine to my answer for comparison.– AllanFeb 24, 2011 at 13:27
what you need to verify in the smb.conf is that your workgroup is the same as the one in the windows station Apr 27, 2012 at 17:35
3The Paste you are looking for does not currently exist.– ulidtkoAug 11, 2014 at 13:37
@David: That's using the Avahi system to resolve your names, which the
mdns4directives specify. That's a different system than Samba, so if you want Samba to work, you have to keep testing without the
.localdomain.– palswimApr 1, 2016 at 19:37
apt-get install winbind fixed it for me.
You may have to install the package libnss-winbind to be able to find windows computers by hostname. Simply installing winbind may not work. See answer.
Beautiful, worked for me on Ubuntu 14.04. Installing winbind by itself didn't work. Apr 23, 2014 at 16:22
Had the same problem, Ubuntu 14.04 trying to access PC with Windows 8. In addition to above recommendation I had to install
sudo apt-get install libnss-winbind
I'm running 18.04 and have been trying to solves this problem for almost a whole day. This was the (last) thing I was missing. Many thanks! Jan 15, 2020 at 14:47
If you have edited your
/etc/nsswitch.conf file and installed
winbind already (
samba-winbind) and still have problems, you may need to disable your NSCD (Name Service Cache Daemon).
sudo apt-get install winbind libnss-winbind
sudo vi /etc/nsswitch.conf
hosts: files dns wins myhostname
sudo vi /etc/samba/smb.conf
[global] wins server = x.x.x.x name resolve order = host
Reboot for best results, or just:
sudo /etc/init.d/samba restart