I have installed and configured(?) samba on a Raspberry Pi B+ running Raspbian 5/5/2015 and I am not able to ping or connect to/via it's hostname. I can connect via it's IP address, but I discovered this problem in testing a samba share.

I found this superuser question, Unable to resolve hostname to ip, that explains the basics fairly well, but it seems that I'm having some sort of problem.

What files or settings can I check or change to be able to get hostname resolution working to the raspberry pi?

Samba kind of works, but I think there is a permissions issue I have to track down. So maybe there's an issue with the name resolution of Samba?

When I was testing, I tested from the following machines:

  • Windows 7 laptop
  • Android phone using PingTools
  • pesudo-custom hardware running custom Ethernet stack (Crestron MPS-200)
  • NetGear WNDR3800

None of the devices were able to ping "raspberrypi" to resolve its name to its IP address. The WNDR3800 could see the raspi, and see its name, and after rebooting the router I was not able to get name resolution working.

Asking in the #raspberrypi IRC channel, there was a guy that wanted to talk about WINS servers. I don't have a WINS server at home, but there is one at the office, and I'll be continuing the testing/troubleshooting at the office.

This is the guide I was following to set up Samba: How to Turn a Raspberry Pi into a Low-Power Network Storage Device

I've been hitting every branch of the tree on the way down, so while it's a well made and well meaning guide, I think it's too out of date to recommend to anyone anymore.


I brought the Pi to work to test, adding lines to config files per an answer suggested and I still have the same results.

I added:

NetBIOS name = raspberrypi

to /etc/samba/smb.conf because there wasn't even a section for NetBIOS name. I think that's worth noting, since the default config seems to have everything there ready to be ucommented.

I added wins in front of [NOTFOUND=return] in the /etc/nsswitch.conf file per the instructions to:

Make sure that the file /etc/nsswitch.conf contains a line like:
   hosts:          files mdns4_minimal dns mdns4 wins [NOTFOUND=return]
where the important part is that you have wins before the NOTFOUND part. 

The line in that file currently reads:

hosts:          files mdns4_minimal wins [NOTFOUND=return] dns mdns4

After making the changes I did a shutdown and then power cycled the raspi. They did not have the desired effect. I cannot ping "raspberrypi" and have it resolve to an IP address.

nmblookup doesn't appear to be a windows command. But if I use it on the raspi itself, it returns the IP address of the raspi.

From the raspi, if I ping "raspberrypi", I will get the name resolved, though to the loopback adapter:

Update 2

I had pretty much given up on trying to access it by name. After all, I'd probably be OK without accessing it by name. I'd prefer to use the name, but if the Linux-hate is flowing so strongly, I figured I would try something else.

I started to test the actual samba networking again. Turns out that's going to be another topic. But while I was looking in Windows Explorer, I saw RASPBERRYPI show up in the list under Network!

something like this

I clicked on it and eventually got error 0x80070035 which is a very popular term on the net. Though I haven't found anything relevant to Linux yet.

raspi network error

If I click on the diagnose button, I get this:

raspi network error 2

Eventually I get this:

raspi network error 3

And then it finishes up with this:

raspi network error 4

  • Some more pieces of information are needed. 1. What happens if you do nmblookup [hostname] on the Pi (replace [hostname] with the actual hostname)? 2. Are you trying to access the Pi by hostname from another Linux host or a Windows host? 3. If you're trying to access the Pi from a Linux host, can you post the contents of /etc/nsswitch.conf of the Linux client? Please update your post with these additional pieces and notify me by replying to this comment. – Larssend Jul 22 '15 at 6:23
  • updated @Larssend – YetAnotherRandomUser Jul 22 '15 at 14:07

There are actually two parts to this:

1.First, in the file /etc/samba/smb.conf, in the [global] section, the first two lines must be:

 workgroup = WORKGROUP
 NetBIOS name = TheNameOfYourPi

(if the name of your workgroup is not WORKGROUP, change the first statement accordingly).

  1. Make sure that the file /etc/nsswitch.conf contains a line like:

    hosts:          files mdns4_minimal dns mdns4 wins [NOTFOUND=return]

where the important part is that you have wins before the NOTFOUND part.

| improve this answer | |
  • These seem important, but alas did not have the desired effect. I've updated the original question with more information. – YetAnotherRandomUser Jul 22 '15 at 14:00

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.