4

It seems that this is the best way to get the Bonjour name from an IP address:

$ dig -x 192.168.214.108 @224.0.0.251 -p 5353

; <<>> DiG 9.8.3-P1 <<>> -x 192.168.214.108 @224.0.0.251 -p 5353
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 15357
;; flags: qr aa; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;108.214.168.192.in-addr.arpa.  IN  PTR

;; ANSWER SECTION:
108.214.168.192.in-addr.arpa. 10 IN PTR David-iPhone.local.

;; Query time: 40 msec
;; SERVER: 192.168.214.108#5353(224.0.0.251)
;; WHEN: Sat Sep  5 12:10:08 2015
;; MSG SIZE  rcvd: 78

This works as expected on my Macbook Pro. However, running dig on another device (Raspberry Pi), there are no results:

$ dig -x 192.168.214.108 @224.0.0.251 -p 5353

; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> -x 192.168.214.108 @224.0.0.251 -p 5353
;; global options: +cmd
;; connection timed out; no servers could be reached

Why is that? How can I get the same results when calling dig from the Raspberry Pi? The host can be pinged just fine from the Raspberry Pi.

I'm looking to gather as much information as possible from network devices, happy to consider other approaches. (the name ("Joe's iPhone") of iOS/mobile devices is especially valuable)

1 Answers1

3

It may be that dig on Raspbian might be using a non-mDNS-aware DNS resolver library, which doesn't know to listen for mDNS answers on 224.0.0.251:5353.

See if your Raspbian Avahi install includes the avahi-resolve --address or avahi-resolve-address commands, and use those instead of dig.

Spiff
  • 110,156