4

I have an Ubuntu 11.04 computer with two vms : debian and windows xp. Each vm also has Host-only connection so I can see them from Host without setting up port forwarding.

All machines can ping each other using ip addresses, but the linux machines(ubuntu host and debian guest) cant ping windows xp by name, only by using tools like 'nmblookup' or by typing 'smb://hostname' in nautilus. Windows XP can ping all machines by name.

Surely I must be missing some configuration in smb.conf. Here is the current one I'm using :

[global]
workgroup = WORKGROUP
server string = %h server (Samba, Ubuntu)
name resolve order = bcast host lmhosts wins     
printing = cups
printcap name = cups
printcap cache time = 750
cups options = raw
use client driver = yes
map to guest = Bad User
usershare allow guests = Yes
usershare max shares = 100
usershare owner only = False

Any help will be appreciated.

Thiago Padilha
  • 289
  • 1
  • 4
  • 10

2 Answers2

7

It's not just Samba!

You need to have Winbind installed, which also installs the Name Service Switch library needed to do what you're looking for. If /lib/libnss_winbind exists on your system, all you should need to do is modify the hosts line in /etc/nsswitch.cfg:

hosts     files dns winbind

The key thing being the winbind line. That tells Linux to use the Windows system for name-resolution.

sysadmin1138
  • 131,083
  • 18
  • 173
  • 296
  • 2
    Installing just the ''winbind'' package doesn't include this, I also had to install the ''libnss-winbind'' package. Thanks for this - it was the final piece of the puzzle. – Aaron D Sep 10 '13 at 03:46
  • Something seems to have changed with Samba 4.4 where just this configuration doesn't suffice any more. Since I updated my system, I can't make NetBIOS name resolution work (`nmblookup host` works, but not `ping host`). – palswim Apr 29 '16 at 05:50
  • 5 years is a long time, even for Samba. – sysadmin1138 Apr 29 '16 at 12:55
2

Same as the previous comment, but on Arch things are a bit different...

First I made sure nmblookup WinXpClient resolves proper ip and Nmbd service running etc.

On arch linux I had to install nss-mdns and edit /etc/nsswitch.conf to

hosts     files dns wins

(append wins to hosts line)

systemctl enable avahi-daemon.service
systemctl restart avahi-daemon.service
ping WinXpClient

and it works.. or check resolveip WinXpClient

Jakuje
  • 9,145
  • 2
  • 40
  • 44
Zui
  • 21
  • 1
  • 2
    No; Avahi is a completely different method (same with MDNS). Those methods probably duped you into thinking that your WINS name resolution worked. – palswim Apr 29 '16 at 06:15
  • windows 10 just works with avahi on my ubuntu 20.04, I can ping `Win10Client.local`. YOU HAVE TO USE `.local` – iuridiniz Sep 08 '21 at 17:27