25

I have a small network with Windows and Linux machines connected to a D-Link DIR-825 router.

The Windows machines on the network can reach all other machines by name while the Linux machines only can reach other machines by IP-address.

I can see all the machines listed with names and their DHCP assigned addresses in the DHCP client status list in the router web admin interface.

Why can't the Linux machines find any other machine by name while Windows has no problem finding the Linux machines?

Scott Pack
  • 14,717
  • 10
  • 51
  • 83
Per Salmi
  • 351
  • 1
  • 3
  • 4
  • 2
    How is your name resolution done? DNS? Do you have a search suffix configured? – Shane Madden Jan 21 '12 at 21:01
  • All machines are using DHCP, connected to the D-Link router where they seem to register themselves and that is probably enough for Windows to find all machines. But the Linux machines do they really require a local DNS server other than the router? – Per Salmi Jan 21 '12 at 21:12
  • Unsure about that particular router, but most consumer routers don't integrate DHCP clients into their internal DNS service. Joe's answer is likely your culprit. – Shane Madden Jan 21 '12 at 21:14
  • Then the Linux machines would respond to LLMNR messages but not use it themselves to find other machines? – Per Salmi Jan 21 '12 at 21:22

5 Answers5

42

My current findings are:

  • Windows uses NetBIOS names, and such protocol, being a broadcast one, allows them to find each other without any central server.

  • Linux machines in modern distros uses natively a protocol called Avahi, which is also a server-independent, broadcast protocol. Local network machines have a suffix .local, so you can ping from Linux to Linux using ping hostname.local, or see them with avahi-discover package. some apps in Gnome use avahi to list machines in the network (for example, the Remote Desktop Viewer)

  • Installing Samba on a Linux machine will assign it a NetBIOS name (or, more technically, will make a Linux machine advertise itself in broadcast requests with their NetBIOS name, which is by default their hostname), and that allows Windows machines to find the Linux ones.

  • Gotcha: Although Linux machines with Samba will reply to NetBIOS protocol requests, with default settings in distros like Ubuntu it won't use NetBIOS as a method to resolve names, and that's why Linux machines can't "see" each other or the Windows machines. For that, you need to edit /etc/nsswitch.conf file and add wins to the list in this line:

    hosts:          files mdns4_minimal [NOTFOUND=return] dns wins mdns4
    
  • You may need to install winbind (and, if not installed automatically, libnss-winbind) package for the above to work.

  • So, for the visibility issue, you either install Samba on all Linux machines (and also edit /etc/nsswitch.conf to enable NetBIOS name resolution), or you install Avahi support in Windows machines.

  • As for file sharing, Samba provides Linux machines file-sharing capabilities with Windows. Theres no need to edit /etc/nsswitch.conf for Linux machines to see shared folders of each other and Windows (and vice-versa) in the "Network" section of Nautilus

genpfault
  • 109
  • 6
MestreLion
  • 1,551
  • 12
  • 10
  • 2
    for the `nsswitch.cong` thing: If `ping HOSTNAME` gives you a system error, that's the signal that the libnss-winbind package is needed. – Michael Stum Oct 12 '18 at 18:47
  • works ! my raspberrypi3 is visible on Win10 with hostname `raspi3`, but on Ubuntu it's `raspi3.local` – razor Dec 09 '20 at 09:45
18

By default, without a DNS server, windows can use NetBIOS (a Microsoft name resolution protocol) to discover the names of other windows systems local to their network. As mentioned in this answer, it looks like you need to setup SAMBA (or at least winbind) on the Linux side. Here is a basic set of instructions:

To enable Windows netbios name resolution from a Linux computer, make sure that Samba is installed (although the smb service does not need to be running). The Samba suite includes winbind, which enables Windows host names to be resolved. Then edit /etc/nsswitch.conf and change this line:

hosts: files dns

to this:

hosts: files dns wins

Then test by pinging the computer name of Windows machine on the LAN:

$ ping windowsbox

BTW, this has nothing to do directly with WINS. WINS is a NetBIOS server typically used in larger networks to cut down on broadcast traffic, provide a legacy centralized name resolution platform, and ultimately to enable systems on different networks to know each others' NetBIOS-name-to-IP mapping.

An alternative to SAMBA would be to setup a DNS server and ensure dynamic DNS updates are configured or that DHCP can register DNS records.

Dustin Wyatt
  • 103
  • 4
Eric C. Singer
  • 2,319
  • 15
  • 17
3

Most probably LLMNR.

joeqwerty
  • 108,377
  • 6
  • 80
  • 171
  • 1
    So would that make the Windows machines find the Linux boxes using the router DHCP registered information then? But Linux doesn't support using the router registered names to find anything? – Per Salmi Jan 21 '12 at 21:14
  • 5
    Whilst this may theoretically answer the question, [it would be preferable](http://meta.stackexchange.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. – Mark Henderson Jan 21 '12 at 21:34
  • It doesn't feel like the LLMNR explains why Windows can find the Linux boxes but not the other way around. If Linux doesn't use LLMNR it would result in Windows finding Windows but not Linux? – Per Salmi Jan 21 '12 at 21:40
2

You probably just need to set up Avahi/mDNS Resolution. It does kind of the same as LLMNR on Windows.

juwi
  • 573
  • 5
  • 14
0

Linux can resolve local names though the necessary software isn't installed by default ...

Most Linux distros make few presumptions regarding your software requirements beyond the kernel ... Debian reference DNSMasq

apt-cache search dnsmasq ...