Путеводитель по Руководству Linux

  User  |  Syst  |  Libr  |  Device  |  Files  |  Other  |  Admin  |  Head  |



   systemd.dnssd    ( 5 )

конфигурация DNS-SD (DNS-SD configuration)

  Name  |  Synopsis  |  Description  |  [service] section options  |    Examples    |  See also  |  Note  |

Примеры (Examples)

Example 1. HTTP service

# /etc/systemd/dnssd/http.dnssd [Service] Name=%H Type=_http._tcp Port=80 TxtText=path=/stats/index.html t=temperature_sensor

This makes the http server running on the host discoverable in the local network given MulticastDNS is enabled on the network interface.

Now the utility "resolvectl" should be able to resolve the service to the host's name:

$ resolvectl service meteo._http._tcp.local meteo._http._tcp.local: meteo.local:80 [priority=0, weight=0] 169.254.208.106%senp0s21f0u2u4 fe80::213:3bff:fe49:8aa%senp0s21f0u2u4 path=/stats/index.html t=temperature_sensor (meteo/_http._tcp/local)

-- Information acquired via protocol mDNS/IPv6 in 4.0ms. -- Data is authenticated: yes

"Avahi" running on a different host in the same local network should see the service as well:

$ avahi-browse -a -r + enp3s0 IPv6 meteo Web Site local + enp3s0 IPv4 meteo Web Site local = enp3s0 IPv6 meteo Web Site local hostname = [meteo.local] address = [fe80::213:3bff:fe49:8aa] port = [80] txt = ["path=/stats/index.html" "t=temperature_sensor"] = enp3s0 IPv4 meteo Web Site local hostname = [meteo.local] address = [169.254.208.106] port = [80] txt = ["path=/stats/index.html" "t=temperature_sensor"]