Dns-sd: how to manually register a remote service

I have a service on another remote system that is on a different physical network and its multicast packets do not get into my local system, so I cannot see its published DNS-SD services.

Do I have a way that I can manually register on my local machine so that applications display only open DNS-SD services?

+4
source share
2 answers

With Avayi, temporary registrations can be created using avahi-publish , and permanent registrations can be created by writing a static service file. See man 1 avahi-publish for earlier and man 5 avahi.service for later for more man 5 avahi.service .

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

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

If the service to which you are registered as a proxy server already has a unicast DNS host name, 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 does not have a host name, a unique name must 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 
+7
source

This is exactly what I was looking for. I wanted to make a service hosted on a system other than OS X visible from outside the home network. Elsewhere here I learned how to use scutil to find out my network Back to My Mac:

 echo show Setup:/Network/BackToMyMac | scutil | sed -n 's/.* : *\(.*\).$/\1/p' 

So I can take this and use it to populate this:

 BTMM=`echo show Setup:/Network/BackToMyMac | scutil | sed -n 's/.* : *\(.*\).$/\1/p'` dns-sd -P <advertised host name> _ssh._tcp ${BTMM} 22 <real host name> <real IP addressโ€”could be a hostname if it resolves> path=/ 

The beauty is that I donโ€™t have to forget anything before leaving the house while some version of ZeroConf is working. I can advertise a remote service, wherever I am, use it, and then shoot ads. So I run the commands, and then look in my shell -> New Remote Command dialog, and here it is. Then I can copy files back and forth, run commands, access my home network as if I were there.

0
source

Source: https://habr.com/ru/post/1381510/


All Articles