Hello, can i ask about random stuff here? Actuall...
# random
p
Hello, can i ask about random stuff here? Actually i wonder why i can't do "ping rpi3dev1" from a windows PC on the same network. Even if my hostname on the raspberry pi device is right:
pi@rpi3dev1:~ $ cat /proc/sys/kernel/hostname
rpi3dev1
pi@rpi3dev1:~ $ ifconfig
...
inet 192.168.35.6 ...
But i can ping that IP-adress from the windows PC.
h
Your windows pc doesn't know about the hostname of the RPi. You either need a DNS server in your network or you have to put an entry in the
C:\Windows\System32\drivers\etc\hosts
.
p
Thanks for your explainations. So if i dont have a DNS server nor an entry in windows hosts-file, then no one on the network will have some practical usage of the hostname of that raspberry pi?
I mean it is impossible to do ssh or ping or something just by using the hostname-string.
Only the ip-adress on the raspberry pi will work to access it? 😕
n
some routers can be configured to have their own DNS for the network based on hostnames of connecting devices, or it can be added via scripting or you could make your RPi a DNS server, but then you still need to add it to at least the DNS configurations of all your devices
p
Okay interesting. So for example on routers for local area networks. There could be a DNS server available in the router web-GUI? The router could both act as router and DNS server? For example if the router have 192.168.1.1. Then the DNS server are also located at 192.168.1.1 ?
s
DNS is the service that translates host names to IP addresses
by definition if DNS is missing or misconfigured, you cannot use hostnames as targets
most consumer routers already perform local DNS for you
if you set your NIC’s DNS servers to, say, Google or Cloudflare’s DNS rather than your router, then that might be breaking local host lookup
p
So windows computers on a home network (with a consumer router) might have the "Preferred DNS server" set to the IP-address of the home router? And if i understand things right, the consumer routers DNS server service does two things: 1. Acts as a resolver for internal hostnames (some automatic thing?) 2. Acts as a resolver for external hostnames (like www.google.com?) (If it does it recursive or iterative does not matter i think?)
Actually the internal resolving might work if we are lucky and the DNS service router are pretty smart or might not work if the service is not so smart. I mean if the user feel confused/or are not aware of the DNS service in the router.
n
when i used a consumer router it was basically.. point PC at router, point router at actual DNS server since htne i got a mikrotik / routerboard router and there i have scripts doing the DHCP static adresses and DNS built from hostname + ".lan" and some other steps
p
Okay interesting.
So to let a PC/host/RPi/whatever to have a fresh presence on a LAN. A consumer-like router should be provided/configured with some information about the host: - The MAC-address - The DHCP static adress - The hostname for that host So these things are what the router with DNS service need to be able to invoke the host via an hostname instead of an IP-address? (Invoke: for example do ping, ssh, telnet, access webserver or something other fun)
What if we have different hostnames for the same device (MAC) ? One hostname-string in /etc/hostname and another hostname set on the router for that MAC. Will things behave undefiend or will things be deterministic?
n
the device itself might be able to resolve itself using its hostname, any other device will only listen to what the router / DNS is saying
now there is dicoverability within the network, that might list them as different too
r
IIRC, Raspbian comes with Avahi pre-setup, so as soon as you install Bonjour on Windows machine, it should be able to discover RPi without much configuration. See see info here: https://learn.adafruit.com/bonjour-zeroconf-networking-for-windows-and-linux/overview
p
Okay so that might be a solution. Oh but then i need to install a 3rd party concept on the Windows machine. I think i could do that as a last resort. 15 years ago, I had many Windows XP-computers in my network at home. If was quite fun. What i remember was that i could see all the computers name (hostnames?) in some way from all PCs. Maybe there are some "transparent decentralized hostname-exchange"-feature on windows computers. What i could say is that i had no DNS resolvers, custom hostname configurations in routers or WINS-configurations or something. The hostnames just worked out of the box in my old windows network but o dont remember why.
r
You're recalling SMB / NetBIOS, which has it's own name service and discovery, separate from DNS mentioned above. You can start here: https://www.raspberrypi.org/forums/viewtopic.php?p=234385&sid=64f2069594bdbf50bbee74527fed7436#p234385 Though personally I don't have any experience so can neither guarantee it would work for you as described nor provide any additional assistance on the topic.
p
Oh, NetBIOS. :] That looks like a promising solution. I will check it out. Thanks