Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| docs:guide-developer:mdns [2019/03/10 16:39] – updated ubus commands exploide | docs:guide-developer:mdns [2024/10/17 00:59] (current) – [Config File] bartprokop | ||
|---|---|---|---|
| Line 5: | Line 5: | ||
| //This is early stage documentation, | //This is early stage documentation, | ||
| - | mDNS, also known as Bonjour or zero-configuration networking, enables automatic discovery of computers, devices, and services on IP networks. It is an internet standard documented in [[https:// | + | mDNS, also known as Bonjour or zero-configuration networking |
| - | The umdns package provides a compact implementation of this standard, well integrated with the OpenWrt system environment. In particular, almost all interaction with the daemon is via [[docs: | + | The [[packages: |
| ==== Alternatives ==== | ==== Alternatives ==== | ||
| + | See [[docs: | ||
| + | ==== Config File ==== | ||
| - | * mdnsd - provided | + | < |
| - | * avahi-* - A fairly full, but quite large implementation | + | config umdns |
| + | option jail 1 # enables jail - see procd | ||
| + | list network lan | ||
| + | list network dmz # Provides visibility into both networks, but does not act as a repeater | ||
| + | </ | ||
| + | |||
| + | Note that it may be unsafe to enable umdns on '' | ||
| + | |||
| + | Note that '' | ||
| + | |||
| + | ==== Install ==== | ||
| + | umdns is available starting from OpenWRT 17 and to install it execute '' | ||
| + | |||
| + | ==== Firewall ==== | ||
| + | If you need to advertise on WAN or other networks then UDP port 5353 should be opened in firewall: | ||
| + | <code - / | ||
| + | config rule | ||
| + | option src_port ' | ||
| + | option src '*' | ||
| + | option name ' | ||
| + | option target ' | ||
| + | option dest_ip ' | ||
| + | option dest_port ' | ||
| + | option proto ' | ||
| + | </ | ||
| + | To configure from GUI see " | ||
| ==== Browsing announced services ==== | ==== Browsing announced services ==== | ||
| Line 50: | Line 77: | ||
| }, | }, | ||
| .... | .... | ||
| + | $ ubus call umdns hosts | ||
| + | #Show hosts discovered via mDns | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| </ | </ | ||
| Line 57: | Line 92: | ||
| * TXT records aren't valid json in the dump, so jsonfilter can't be used. | * TXT records aren't valid json in the dump, so jsonfilter can't be used. | ||
| * How long is data cached? What causes it to update? No idea. | * How long is data cached? What causes it to update? No idea. | ||
| + | * You may not see locally advertised services with '' | ||
| ==== Announcing local services ==== | ==== Announcing local services ==== | ||
| - | 'umdns' | + | The umdns scans all the services listed in ubus ('' |
| < | < | ||
| - | # ubus call service list | jsonfilter -e '@[*].instances[*].data.mdns' | + | # ubus call service list | jsonfilter -e "$[*]['instances'][*]['data' |
| { " | { " | ||
| </ | </ | ||
| Line 67: | Line 103: | ||
| Here we can see that ssh is being advertised locally. | Here we can see that ssh is being advertised locally. | ||
| - | If you want to advertise your own service, your service needs to (*AT THE TIME OF WRITING* 2017-07-11) | + | If you want to advertise your own service, your service needs to be a [[docs: |
| < | < | ||
| procd_open_instance | procd_open_instance | ||
| Line 78: | Line 114: | ||
| As an example, the following call | As an example, the following call | ||
| < | < | ||
| - | procd_add_mdns "hoho" " | + | procd_add_mdns "webdav" " |
| </ | </ | ||
| - | will result in advertising '' | + | will result in advertising '' |
| + | In the example we published a WebDAV folder from Nextcloud and now it can be seen in Network folder of a file manager in GNOME and KDE and can be [[https:// | ||
| + | The service names may be taken from the [[https:// | ||
| If you wish to create a more complicated mdns information block, see '' | If you wish to create a more complicated mdns information block, see '' | ||
| + | |||
| + | ===== Service description files in /etc/umdns ===== | ||
| + | umdns advertises the services whose '' | ||
| + | |||
| + | For example the same WebDAV service description: | ||
| + | <code - / | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | ] | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | Or you can advertise SFTP and SSH: | ||
| + | <code - / | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | ] | ||
| + | }, | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | ] | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | See more examples in [[commit>? | ||
| + | |||
| + | The reload the umdns service with: '' | ||
| + | |||
| + | ==== Testing === | ||
| + | To see that service was advertised you may use '' | ||
| + | To see from a command line use '' | ||
| + | To find a specific service use: '' | ||
| + | |||
| + | |||