In my home network, the Linux machines all have avahi installed and can access each other by their hostnames instead of by their IP

ping laptop.local

But for the Windows machine I could only manage to connect to it by directly passing its IP address:


I tried multiple variations of its hostname and none of them worked.

#All of these give an "unknown host" error
ping IE11WIN7
ping IE11WIN7.local
ping IE11Win7
ping IE11Win7.local

Is there a way to, from the Linux command line, connect to the windows machine by passing the hostname instead of the IP?

By the way, I noticed that the machine in question does appear on the "windows network" list if I try to access it via my file browser (Thunar) so if possible I would like if the command-line accessing used a similar trick instead of me having to end up resorting to editing my etc/hosts file by hand.

  • The answer to this question suggests that the "hostname.local" scheme should also work for windows machines but its not working for me... – hugomg Mar 29 '15 at 1:43
  • 1
    Smbclient accepts names, nmblookup can convert name to IP. – Basilevs Mar 29 '15 at 8:33
  • As workaround, if you are interested in the file sharing in your local network, it's always possible to mount the windows shared directory under the linux filesystem (e.g. in your example sudo mount -t cifs // -o credentials=/root/.smbcredential /mnt/WhereYouWant ; here you have to put the credential in the file /root/.smbcred readable only by root for security reasons). – Hastur Mar 30 '15 at 16:21

You need SMB (SAMBA) services running and correctly configured to do that, in your linux (maybe, it's possible with a particular configuration of avahi for smb protocol).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.