dns-sd: how to manually register a remote service

Albert picture Albert · Nov 16, 2011 · Viewed 9.9k times · Source

I have a service on another remote system which is on another physical network and its multicast packages don't get to my local system, thus I don't see its DNS-SD published services.

I there a way I can manually register it on my local machine so that applications which only show DNS-SD discovered services show it?

Answer

andrewtj picture andrewtj · Dec 14, 2011

With Avahi temporary registrations can be created using avahi-publish and persistent ones can be created by writing a static service file. See man 1 avahi-publish for more on the former and man 5 avahi.service for more on the later.

With Bonjour the dns-sd tool can be used to proxy register a service:

dns-sd -P <Name> <Type> <Domain> <Port> <Host> <IP> [<TXT>...]

If the service you're proxy registering already has a unicast DNS hostname something like this will work:

$ dns-sd -P Google _http._tcp local 80 google.com google.com path=/
Registering Service Google._http._tcp.local host google.com port 80 TXT path=/
 4:23:00.928  Got a reply for service Google._http._tcp.local.: Name now registered and active
^C

If it doesn't have a hostname a unique name should be used for the host:

$ dns-sd -P Google _http._tcp local 80 google.local 74.125.237.144 path=/
Registering Service Google._http._tcp.local host google.local port 80 TXT path=/
 4:16:48.208  Got a reply for record google.local: Name now registered and active
 4:16:48.208  Got a reply for service Google._http._tcp.local.: Name now registered and active
^C