1

I want to ssh into my Pi and I can do it right now with the ip address of the Pi. But I want to do it using mDNS. I want to connect using ssh raspberrypi.local. I read that this should work. on the pi, the avahi-deamon is running:

pi@raspberrypi:~ $ service avahi-daemon status
● avahi-daemon.service - Avahi mDNS/DNS-SD Stack
   Loaded: loaded (/lib/systemd/system/avahi-daemon.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2020-09-28 12:01:52 CEST; 35min ago
 Main PID: 326 (avahi-daemon)
   Status: "avahi-daemon 0.7 starting up."
    Tasks: 2 (limit: 1915)
   CGroup: /system.slice/avahi-daemon.service
           ├─326 avahi-daemon: running [raspberrypi.local]
           └─379 avahi-daemon: chroot helper

Sep 28 12:31:21 raspberrypi avahi-daemon[326]: Interface eth0.IPv6 no longer relevant for mDNS.
Sep 28 12:31:21 raspberrypi avahi-daemon[326]: Withdrawing address record for 10.42.0.56 on eth0.
Sep 28 12:31:21 raspberrypi avahi-daemon[326]: Leaving mDNS multicast group on interface eth0.IPv4 with address 10.42.0.56.
Sep 28 12:31:21 raspberrypi avahi-daemon[326]: Interface eth0.IPv4 no longer relevant for mDNS.
Sep 28 12:31:34 raspberrypi avahi-daemon[326]: Joining mDNS multicast group on interface eth0.IPv6 with address fe80::a3a0:c51a:4fa:5bd0.
Sep 28 12:31:34 raspberrypi avahi-daemon[326]: New relevant interface eth0.IPv6 for mDNS.
Sep 28 12:31:34 raspberrypi avahi-daemon[326]: Registering new address record for fe80::a3a0:c51a:4fa:5bd0 on eth0.*.
Sep 28 12:31:45 raspberrypi avahi-daemon[326]: Joining mDNS multicast group on interface eth0.IPv4 with address 10.42.0.56.
Sep 28 12:31:45 raspberrypi avahi-daemon[326]: New relevant interface eth0.IPv4 for mDNS.
Sep 28 12:31:45 raspberrypi avahi-daemon[326]: Registering new address record for 10.42.0.56 on eth0.IPv4.

The hostname is also raspberrypi so that is not the issue. I think the issue might be in my linux system I use to connect to the pi?

If I try to connect this is the error:

➜  ~ ssh raspberrypi.local
ssh: Could not resolve hostname raspberrypi.local: Name or service not known

avahi-browse -arp and avahi-resolve-host-name both also do not work.

My linux system is Fedora 32. I have checked that Avahi is running (same command as on the pi).

I connected the raspberry pi with an ethernet cable to my computer (which is using WiFi). I am sharing my WiFi to my Pi by setting the wired connection to "Shared to other computers" (with both IPv4 and IPv6).

Here is the avahi config on the pi:

pi@raspberrypi:~ $ cat /etc/avahi/avahi-daemon.conf 
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# avahi is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with avahi; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA.

# See avahi-daemon.conf(5) for more information on this configuration
# file!

[server]
#host-name=foo
#domain-name=local
#browse-domains=0pointer.de, zeroconf.org
use-ipv4=yes
use-ipv6=yes
#allow-interfaces=eth0
#deny-interfaces=eth1
#check-response-ttl=no
#use-iff-running=no
#enable-dbus=yes
#disallow-other-stacks=no
#allow-point-to-point=no
#cache-entries-max=4096
#clients-max=4096
#objects-per-client-max=1024
#entries-per-entry-group-max=32
ratelimit-interval-usec=1000000
ratelimit-burst=1000

[wide-area]
enable-wide-area=yes

[publish]
#disable-publishing=no
#disable-user-service-publishing=no
#add-service-cookie=no
#publish-addresses=yes
publish-hinfo=no
publish-workstation=no
#publish-domain=yes
#publish-dns-servers=192.168.50.1, 192.168.50.2
#publish-resolv-conf-dns-servers=yes
#publish-aaaa-on-ipv4=yes
#publish-a-on-ipv6=no

[reflector]
#enable-reflector=no
#reflect-ipv=no

[rlimits]
#rlimit-as=
#rlimit-core=0
#rlimit-data=8388608
#rlimit-fsize=0
#rlimit-nofile=768
#rlimit-stack=8388608
#rlimit-nproc=3

I am not sure why my system is not able to find the Pi... If you need any more information, I'll be glad to provide!

1
  • What is the ip address and netmask of the device where try to connect to the RasPi? – Ingo Sep 30 '20 at 17:02
1

You may have to amend the config file for the GNU Name Service Switch at /etc/nsswitch.conf to include mdns4_minimal when resolving domain names.

In my case (Ubuntu 20.04 + KDE):

  • I had this: hosts: files dns
  • I changed it to: hosts: files dns mdns4_minimal

After the change above I was able to do ssh pi@raspberrypi.local and successfully log into my Raspberry Pi without using a dynamic IP (e.g. something assigned via DHCP by the router to my Raspberry Pi).

See for reference:

1
  • I unfortunately already have mdns4_minimal in my conf file. However, I have fixed the issue by connecting my pi directly to my router instead of sharing WiFi through an ethernet cable with the pi. – Maarten Meijer Oct 5 '20 at 15:04
0

You have been over thinking this and/or confused by posts about Zero-conf

From most OS (with the exception of some Windows) you can resolve the name raspberrypi.local e.g with ping raspberrypi.local.

To connect via ssh you need to use the correct commands e.g. ssh pi@raspberrypi.local for a normal Raspberry Pi OS.

NOTE Occasionally this will fail, due to caching in the network, but this is unusual.

1
  • The ping and ssh both do not work as I said... I accidentally forgot the user indeed for the ssh but it doesn’t change anything sadly. – Maarten Meijer Sep 29 '20 at 22:25

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.