1

My raspberrypi (Raspberry Pi 2, Model B) has a network name (raspberrypi). I did not do any changes on the network configuration.

When I connect the Pi to a network that has internet connection, I can easily access the Pi via ssh pi@raspberrypi.

When I connect the Pi to a network that has no internet connection (Router, DNS activated), then I cannot access the Pia via its raspberrypi anymore. But the connection is alright, because I can access the Pi by using the dynamically associated IP-Adress.

How can I fix this, so that the Pi is always available with the name?

  • you could set a static ip and make an entry in your hosts file. – Steve Robillard May 20 '15 at 8:04
  • You need to give us more information. What are you trying to access it from? There are a number of methods of setting up zero-conf on the Pi. – Milliways May 20 '15 at 8:09
  • There's an avahi daemon installed on Raspbian, which is probably how the other computer is finding the name. Why it doesn't do that when there's no internet connection would seem to be an issue with the other computer, which you have not identified. – goldilocks May 20 '15 at 12:28
1

There are 4 common ways to address a networked computer

You can try

nmblookup raspberrypi

to see if Zeroconf is working.

  • 1
    What does Windows Internet Name Service have to do with the Pi? It may seem a shock, but there are large (and increasing) numbers of people who don't use Windows. `zeroconf`` is a more general solution, AFAIK applicable to all common platforms. – Milliways May 20 '15 at 9:56
  • @Milliways Indeed. And Raspbian does run a zeroconf daemon (avahi) by default, which is presumably what's in play here. None-the-less this answer is at least a good introduction to the topic, which as user1133275 points out, is mostly off-topic here. – goldilocks May 20 '15 at 12:32
  • Thanks @Milliways I have updated the answer to reflect modern Zeroconf usage. (The man page for nmblookup still references WINS instead of Avahi but I guess it's like calling samba a windows share) – user1133275 May 21 '15 at 15:26
1

Rather than configuring every device on my network with avahi or other solutions, I resolved this issue by setting up an internal dns/dhcp server using dnsmasq (in raspbian repositories). I have a Raspberry Pi B (old model) taking over all dns and dhcp duties from my Internet router. Every new RPi that gets an address via dhcp can be pinged by hostname (e.g. raspi01, raspi02, etc.) without touching the new RPi configuration. I can also easily set up aliases for machines (e.g. the RPi running dnsmasq, "raspi05", is also "netservices"). It also runs netatalk and samba for Apple and Windows filesharing, as well as CUPS to service a USB-connected printer.

1

A solution I have used for some time now is through the link-local IPv6 address. This is the address beginning with "fe80:" the ifconfig command gives you on the RP, just below the IPv4 address. It will always be the same regardless of network configuration, and can be stuck into your host computer's host file.

As a derivative of the Debian distribution, Raspbian is well equipped to use IPv6. I am no longer current on this, but at one point in time using IPv6 actually needed to be configured (see: https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=15886).

  • 1
    Unfortunately netatalk and tightvncserver on the Pi cannot connect via ipv6, although these work using ipv4. – Milliways May 21 '15 at 1:23
  • I wasn't aware of that, thanks for the heads-up. Perhaps switch to vnc4server, then? – ALAN WARD May 21 '15 at 12:56

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.