Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
docs:guide-developer:mdns [2021/05/05 21:50] – [Firewall] stokitodocs:guide-developer:mdns [2024/10/17 00:59] (current) – [Config File] bartprokop
Line 10: Line 10:
  
 ==== Alternatives ==== ==== Alternatives ====
- +See [[docs:guide-user:network:zeroconfig:zeroconf|Zero configuration networking in OpenWrt]]
-  * mdnsd - provided by Apple's mDNSResponder package +
-  * [[https://wiki.archlinux.org/title/avahi|avahi]] - A fairly full, but quite large implementation +
 ==== Config File ==== ==== Config File ====
  
 <code - /etc/config/umdns> <code - /etc/config/umdns>
 config umdns config umdns
-        option jail 1 + option jail 1 # enables jail - see procd 
-        list network lan + list network lan 
-        list network dmz # Provides visibility into both networks, but does not act as a repeater+ list network dmz # Provides visibility into both networks, but does not act as a repeater
 </code> </code>
 +
 Note that it may be unsafe to enable umdns on ''wan'' interface. Note that it may be unsafe to enable umdns on ''wan'' interface.
 +
 +Note that ''%%network list%%'' argument refers to interface name under ''%%/etc/config/network%%'' not the device name shown by ''%%ifconfig%%''. Test if you using the right name with ''%%ifstatus%%''. So if you have something like ''%%config interface 'vlan1'%%'' in your ''%%/etc/config/network%%'', use ''%%vlan1%%''.
  
 ==== Install ==== ==== Install ====
Line 28: Line 28:
  
 ==== Firewall ==== ==== Firewall ====
-UDP port 5353 should be opened in firewall:+If you need to advertise on WAN or other networks then UDP port 5353 should be opened in firewall:
 <code - /etc/config/firewall> <code - /etc/config/firewall>
 config rule config rule
Line 35: Line 35:
         option name 'Allow-mDNS'         option name 'Allow-mDNS'
         option target 'ACCEPT'         option target 'ACCEPT'
-        list dest_ip '224.0.0.251'+        option dest_ip '224.0.0.251'
         option dest_port '5353'         option dest_port '5353'
-        list proto 'udp'+        option proto 'udp'
 </code> </code>
 To configure from GUI see "Firewall rules" section of [[https://blog.christophersmart.com/2020/03/30/resolving-mdns-across-vlans-with-avahi-on-openwrt/|Resolving mDNS across VLANs with Avahi on OpenWRT]] To configure from GUI see "Firewall rules" section of [[https://blog.christophersmart.com/2020/03/30/resolving-mdns-across-vlans-with-avahi-on-openwrt/|Resolving mDNS across VLANs with Avahi on OpenWRT]]
Line 97: Line 97:
 The umdns scans all the services listed in ubus (''ubus call service list'') and looks for ''mdns'' objects in their data object. You can view this more selectively for example with: The umdns scans all the services listed in ubus (''ubus call service list'') and looks for ''mdns'' objects in their data object. You can view this more selectively for example with:
 <code> <code>
-# ubus call service list | jsonfilter -e '@[*].instances[*].data.mdns'+# ubus call service list | jsonfilter -e "$[*]['instances'][*]['data']['mdns']"
 { "ssh_22": { "service": "_ssh._tcp.local", "port": 22, "txt": [ "daemon=dropbear" ] } } { "ssh_22": { "service": "_ssh._tcp.local", "port": 22, "txt": [ "daemon=dropbear" ] } }
 </code> </code>
Line 134: Line 134:
       "path=/nextcloud/remote.php/dav/files/YOUR_USER/",       "path=/nextcloud/remote.php/dav/files/YOUR_USER/",
       "u=YOUR_USER"       "u=YOUR_USER"
 +    ]
 +  }
 +}
 +</code>
 +Or you can advertise SFTP and SSH:
 +<code - /etc/umdns/ssh.json>
 +{
 +  "ssh_login": {
 +    "service": "_ssh._tcp.local",
 +    "port": 22,
 +    "txt": [
 +      "u=root"
 +    ]
 +  },
 +  "sftp_share": {
 +    "service": "_sftp-ssh._tcp.local",
 +    "port": 22,
 +    "txt": [
 +      "path=/",
 +      "u=root"
     ]     ]
   }   }
Line 139: Line 159:
 </code> </code>
 See more examples in [[commit>?p=project/mdnsd.git;a=tree;f=json;hb=HEAD|umdns sources]] See more examples in [[commit>?p=project/mdnsd.git;a=tree;f=json;hb=HEAD|umdns sources]]
 +
 +The reload the umdns service with: ''ubus call umdns reload'' or ''service umdns reload''
  
 ==== Testing === ==== Testing ===
-To see that service was advertised you may use ''avahi-discover'' or ''avahi-browse -d local _webdav._tcp.local''+To see that service was advertised you may use ''avahi-discover'' GUI application. 
 +To see from a command line use ''avahi-browse --all''
 +To find a specific service use: ''avahi-browse -d local _webdav._tcp''
 + 
  • Last modified: 2021/05/05 21:50
  • by stokito