11

I have a simple home network with Windows 7 machines and Linux machines (Fedora 12 and 13). I'd like to be able to resolve the Linux machine names from the windows machine. For example:

-- Windows 7 ping mylinuxmachine

Currently this does not resolve. Any ideas?

3 Answers 3

7

It is an old question, but I hope that I still can help some people who are stuck on this issue.

On, for example, Ubuntu you can do the following:

Open the following file: /etc/nsswitch.conf

nano /etc/nsswitch.conf

Change this line:

hosts: files dns

To:

hosts: files wins dns

Then install winbind:

sudo apt-get install winbind

Note: if you already have samba installed, you may find winbind is already enabled.

Check that the winbind service exists and is enabled:

sudo systemctl status winbind.service

You can enable the service as follows:

sudo systemctl enable winbind.service

Now your Linux hostname can be resolved on your Windows PC.

To find out what your hostname is on Linux use:

hostname
2
  • Excellent! Got my raspberry pi to be visible by its host name on windows network! I was ready to give this up.
    – vlsh
    May 23, 2019 at 11:25
  • This worked perfectly on Debian 11, using "home-assistant" hostname so I can browser that domain from any windows PC one the net without knowing the IP. (even though I reserved it.)
    – eitama
    Mar 10, 2023 at 18:14
6

If you don't have a DNS server on your network (e.g. from your router), then you need to enable the Samba service and open up the NetBIOS ports (137-139) in your firewalls. The Fedora Firewall tools already have a default entry set up for this (may be described as something to do with "Windows File Sharing").

1
  • More specifically, NetBIOS name resolution is done by the nmbd daemon of Samba. (If you only need name resolution but don't want the Linux box to act as a SMB server, it is possible to disable smbd.) May 27, 2010 at 20:22
4

Rather than messing with Samba and the NetBIOS name service, I prefer to add the name to %SYSTEMDIR%\drivers\etc\hosts. The format and function of this file is identical to /etc/hosts on Linux. So you would add something like:

192.168.0.50  mylinuxmachine

Of course this works best if you assign static (or pseudo-static) IP addresses. By pseudo-static I mean the client uses DHCP, but the MAC address is stored in the DHCP server so that it always gives out the same IP address. You can still do this and have normal dynamic IP addresses for other hosts, just make sure to not assign any static addresses that fall in the dynamic range.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .