2

In my LAN I have:

  • 2 Windows PCs (Peach and Cocotero)
  • My RPi3 with Rasbian

In any of my Windows PCs, PING works perfectly against any of the host.

But when I perform a PING inside my RPi3 it, it seems it doesn't resolve the names. It says:

ping: Cocotero: Name or service not known

ping: Peach: Name or service not known

However, PING works when I use the local IPs of my PCs.

EDIT: I found out that there is a StackExchange community for the Raspberry Pi. Someone, please move. Thanks!

SuperJMN
  • 153
  • 1
  • 6
  • `ping` in linux doesn't use `avahi`, and you have only avahi based hostnames, not real dns records. Possibly duplicate of https://superuser.com/questions/704785/avahi-ping-cant-resolve-hostname-but-nslookup-can – Ipor Sircer Oct 29 '17 at 22:36
  • Not only ping, I have a script that uses UNC paths and it cannot resolve the names. What should I do to make UNC paths revolve? – SuperJMN Oct 29 '17 at 22:42
  • 1
    If you haven't set up some way for this to work, then it won't work. – David Schwartz Oct 29 '17 at 23:00

2 Answers2

2

You should check the DNS settings at your Raspbian.

Do a cat /etc/resolv.conf?to check what your current DNS settings are.

I assume your router is set as DNS for you Windows PCs. Set the DNS server in /etc/resolv.conf to the IP address of your router. That file should look like this:

nameserver 192.168.0.1

You have to change the IP address to your router's address.

chloesoe
  • 716
  • 3
  • 10
  • Hey, it seems my resolv.conf is generated automatically resolvconf. These are the contents: # Generated by resolvconf nameserver 80.58.61.250 nameserver 80.58.61.254 – SuperJMN Oct 30 '17 at 11:08
  • If I change the file, it's overwritten each time I reboot/connect/disconnect the wlan0 interface. What should I do to make the changes permanent? Thank – SuperJMN Oct 30 '17 at 11:09
  • I'm not very used with resolvconf. According to https://www.raspberrypi.org/forums/viewtopic.php?t=57388, you could edit your interface in `/etc/network/interfaces` and add a line (I assume your interface is called eth0) at eth0: `dns-nameservers 192.168.0.1` – chloesoe Oct 30 '17 at 16:03
2

Windows is doing this via NetBIOS and broadcasting/discovering names on your local network. In linux, the nbbd daemon does something similar, when used with Samba/CIFS and smbd

However, ping and the other network diagnostic tools don't reference NetBIOS names in Linux, they do the standard DNS check (well, /etc/hosts then DNS....)

Easiest way to "solve" this is to set up a DNS server on your Pi and use a fake TLD to create a fake domain name and simply create DNS entries. Go a step further and set up dhcpd on the Pi to give out IPs based on Mac addresses.

I do this - when I want to broadcast a file to my TV, I can point to livingroomtv.my.home and when I want to upload files to my iPhone (using OPlayer) I can point my browser to iphone.my.home

ivanivan
  • 2,912
  • 1
  • 11
  • 9