4

RPI can be accessed from computers in the same LAN by using it's local ip. If I want to access it by a specific name, I can set it up in hosts file. This works nice if RPI has a static ip, but not when it moves from one location to another?

UPnP is used by some programs to programmatically open the ports on the router. Isn't there a similar approach to write the name in to the router?

  • Comments are not for extended discussion; this conversation has been moved to chat. – Ghanima Dec 13 '16 at 13:23
5

Unless you disable it (i.e. by default), Raspbian is running a service called Avahi which responds to mDNS requests in your local network.

By default machines are configured to appear in .local domain, so a fresh Raspbian will be accessible with raspberrypi.local from other machines using Avahi. If you change the hostname, it will be reflected in Avahi response.

Machines also by default are configured to strip .local domain when accessing other ones, so it's usually enough just to access the destination machine by its hostname (like raspberrypi). Hostnames should be of course kept unique to avoid random connections to one or another.


The Avahi service is enabled by default in macOS (implementation known as Bonjour) and most desktop Linux distributions.

It was not available separately for Windows versions earlier than Windows 10, but came with Apple iTunes (and even if you uninstalled iTunes, chances are Bonjour would still remain installed).

With Windows 10, mDNS seems initially was supported natively, but with bugs, and now at least supported programmatically (some reference). This paragraph is subject to change and clarification.


Unless you have a multi-network configuration, Avahi is enough to get your machines discovered without using IP.

With multi-network configuration (i.e. if you use router between two separate IP networks like 192.168.1.0/24 and 192.168.2.0/24 you can set the router as Avahi reflector (provided it has Avahi running), or you can configure DNS as suggested in ppumkin's answer.

  • Apparently Windows 10 has some kind of mDNS support in it now by default. I think they learning slowy :D But yea, I never needed that on any Windows machine, as long as my internal DNS was set up.. – Piotr Kula Dec 13 '16 at 14:08
  • Indeed it looks so, I need to reconnect to a different subnet to check... – techraf Dec 13 '16 at 14:10
  • It doesn't seem to work for me with android devices. See raspberrypi.stackexchange.com/questions/81717/… – Clémentine Mar 23 '18 at 7:02
0

Yes. Its called DNS (Domain Name System)

Home / Small Office networks are usually set up using a router of some kind. This router is responsible for DHCP (assigning IP addresses) and DNS (assigning a domain name to that IP address)

So as long as your router is set up properly: In such that your DHCP sets your router as authoritative DNS with reverse lookup (like rDNS but just an internal router mechanism) setup, then you should be able to ping a default Raspbian install like ping rasperrypi within your Local Area Network.

In many cases, especially with home routers this does not work because reverse lookups are disabled, not implemented or just the router sucks. This is improving though as more IoT devices are running on our LAN's and more routers are using BSD based OS'es - This makes is easy to find them (Yay, 20 years later)

This is a very simple explanation for internal uses. On the internet DNS gets very complicated and only specific entities control how names get resolved.

The

A few things to check on your ipconfig

  • Do you have a DNS entry for your router? The same as gateway? Then outside (ISP/Google/OpenDNS)
  • Log into the router and click on DHCP. Look at any names assigned to the IP. If you cannot see them then maybe your router sucks ;(
  • Again, on your router check in DHCP settings for rDNS or something in that name and enable it. Some routers have it always enabled some do not even offer it. It get messy from vendor to vendor.
  • Make your own router using pfSense or openWRT - You wont regret it.

If your rotuer does not support reverse lookups then techraf's answer explains about why mDNS services where created.

  • Comments are not for extended discussion; this conversation has been moved to chat. You know the rule (and you also know how I like to delete Goldilocks' comments). – Ghanima Dec 13 '16 at 15:19
-1

Its not a direct ancer but For ip lookup i use fing android app https://play.google.com/store/apps/details?id=com.overlook.android.fing To find al my (rpi) divices

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.