Glam Prestige Journal

Bright entertainment trends with youth appeal.

I have two types of device that I want to machine over Ethernet to a host. I want to know which of those two device types is connected.

Both devices use Avahi/Bonjour and have what they call a "Bonjour Service Name" that contains useful information I can use to differentiate the two device types, but network requirements mean that I can't use a blanket mDNS Browse because it'll go out on the secondary network port of the host (which isn't allowed). This "Bonjour Service Name" is consistently used by the devices as the first part of all services they broadcast (e.g. UsefulDeviceName._http._tcp.local, UsefulDeviceName._ftp._tcp.local, UsefulDeviceName._telnet._tcp.local, etc).

Each device of the two types also has its own unique DNS name, but that is just [GenericPrefix][MacAddress].local, which isn't enough to differentiate them (they're from the same manufacturer and so both device types use the same MAC blocks).

Every tool that I've tried so far does an mDNS broadcast across the network and shows the Bonjour Service name, but doesn't meet "not using all ports" network requirement. Running a DNS query like this returns the normal DNS name, not the Bonjour Service Name.

We will know the IP of the device. Is there a simple Linux command that will ask the device "what is your Bonjour Service Name?"/"what Bonjour Service Names do you have?" that can be relied on to only send the packets over the interface that the devices will be connected to, and not the wider network?

3

2 Answers

The answer appears to be "there is no reliable way to do it". Not all devices listen/respond to the dig commands listed in the other answer, and everything else to find mDNS names on the network (like avahi-browse and the badly behaved mdns-scan) requires multicasting/broadcasting and can't be used to probe an individual machine.

dig should work, if you send the same query as various "mDNS browser" tools do:

dig _services._dns-sd._udp.local ptr @ip-address -p 5353

(Optionally add +short.)

Note that there is no "the Bonjour Service name" – each device is free to register multiple services under various names.

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy