Avahi - Chromebook: Hostname konnte nicht aufgelöst werden

885
rodrunner

Ich habe ein Himbeer-Pi (Raspbian Jessie) mit Ssh & Vnc-Diensten in Avahi registriert. Ich kann beide Dienste in meinem Client sehen (Chromebook)

chronos@localhost ~ $ avahi-browse -arl + mlan0 IPv4 raspberrypi SSH _ssh._tcp local + mlan0 IPv4 raspberrypi VNC _rfb._tcp local + mlan0 IPv4 raspberrypi [30:b5:c2:1e:2f:df] _workstation._tcp local = mlan0 IPv4 raspberrypi SSH _ssh._tcp local hostname = [raspberrypi.local] address = [192.168.1.200] port = [22] txt = [] = mlan0 IPv4 raspberrypi [30:b5:c2:1e:2f:df] _workstation._tcp local hostname = [raspberrypi.local] address = [192.168.1.200] port = [9] txt = [] = mlan0 IPv4 raspberrypi VNC _rfb._tcp local hostname = [raspberrypi.local] address = [192.168.1.200] port = [5900] txt = [] 

Und es scheint, dass ich sowohl den Namen als auch die Adresse auflösen kann:

chronos@localhost ~ $ avahi-resolve --address 192.168.1.200 192.168.1.200 raspberrypi.local chronos@localhost ~ $ avahi-resolve --name raspberrypi.local raspberrypi.local 192.168.1.200 

Aber wenn ich versuche, die Himbeere von meinem Chromebook aus zu pingen oder zu ssh, würde das nicht klappen:

chronos@localhost ~ $ ping raspberrypi.local ping: unknown host raspberrypi.local chronos@localhost ~ $ ssh pi@raspberrypi.local ssh: Could not resolve hostname raspberrypi.local: Name or service not known 

Fehlt mir etwas? Ich kann mein Raspberry Pi tatsächlich von einem anderen Client (Arch Linux) in meinem lokalen Netzwerk ssh verwenden, daher sollte das Problem auf der Chromebook-Seite liegen.

Dies ist die Service-Definition, die ich im Raspberry Pi verwende (/etc/avahi/services/ssh.service):

<?xml version="1.0" standalone='no'?><!--*-nxml-*--> <!DOCTYPE service-group SYSTEM "avahi-service.dtd"> <service-group> <name replace-wildcards="yes">%h SSH</name> <service> <type>_ssh._tcp</type> <port>22</port> </service> </service-group> 
4

2 Antworten auf die Frage

1
Paul Wratt

Avahi looks for Avahi services on the lan, queries them to (in your example) show IP resolution.

Use of the IP address on your chromebook will get the result you are looking for (ping reply or ssh access).

Most networks do not store the machine name, just the IP. You can provide your own domain name lookup (for static ip addess) in /etc/hosts (chromebooks must be in developer mode) by adding the line: raspberrypi.local 192.168.1.200

Or by automating it in a script, using sed to replace the line begining with raspberrypi.local, with the output of the command avahi-resolve --name raspberrypi.local. That will work for dynamic IP allocations, but you will still need to run the script at least once everytime the RPi is powered on (in case it changes).

The reason you are not getting a result (that you expect) is because the domain name service (or DNS server) does not know about LAN address names.


The following will also work:

ping `avahi-resolve --name raspberrypi.local` ssh `avahi-resolve --name raspberrypi.local` 

` is on the tilda key (~)

Danke für die Problemumgehungen. Beachten Sie, dass der Domain Name Service für diese Suchvorgänge konfiguriert werden kann. Normalerweise wird Ubuntu beispielsweise konfiguriert, wenn avahi installiert wird, wie in meiner Antwort beschrieben. nealmcb vor 6 Jahren 0
0
nealmcb

Der normale Weg avahi zu unterstützen *.localNamenssuchen so funktioniert es einfach ping raspberrypi.localist über mdns4_minimalin /etc/nsswitch.confzB wie beschrieben an, wie die lokalen DNS - Lookup in Ubuntu 16.10 konfigurieren? - Fragen Sie Ubuntu

Es scheint, dass dies in Chrome OS möglich war, nachdem dieser Fehler behoben wurde: 199397 - FR: Auflösung des mDNS-Namens - Chrom - Monorail, was jedoch bei einigen Netzwerken, die ihre eigene Nicht-mdns- .localDomäne verwendeten, zu Problemen führte, wie bei 626377 beschrieben. Aktivieren Sie die Auflösung des mDNS-Hostnamens, ohne dabei .local Unicast DNS - Chrom - Monorail zu unterbrechen .

Ab Anfang 2018 scheint es, als sei die Ausgabe 626377 kurz vor der Veröffentlichung, um mdns-Lookups wieder zu aktivieren.

In der Zwischenzeit denke ich, dass dies lokal behoben werden kann, wenn Sie in den Entwicklermodus wechseln und Ihre rootfs-Partition ändern. Und bis dahin gibt es einige hilfreiche Workarounds für die Antwort von Paul Wratt.