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.
NetBIOS name = raspberrypi
/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.
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: 127.0.1.1
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!
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.
If I click on the diagnose button, I get this:
Eventually I get this:
And then it finishes up with this: