SYSTEMD.DNSSD(5)
๐ SYSTEMD.DNSSD(5) ๐
okay bestie, welcome to systemd.dnssd โ the manual page for DNS-SD configuration โจ (that's section 5 of the systemd manual, iykyk)
๐ธ NAME ๐ธ
systemd.dnssd โ DNS-SD configuration ๐
๐ฆ SYNOPSIS ๐ฆ
network_service.dnssd
โจ DESCRIPTION โจ
So the actual DNS-SD setup? That's not this file's job โ it's handled by systemd-resolved(8). This page is just about how you configure it, bestie ๐ซถ
Your main network service file must have the extension .dnssd. Any other extension? Ignored. Not it. Bye ๐
Now, where do these .dnssd files even live? They get read from a whole lil squad of directories:
/usr/lib/systemd/dnssdโ the system network directory ๐/usr/local/lib/systemd/dnssdโ also system network ๐ซ/run/systemd/dnssdโ the volatile runtime network directory โก/etc/systemd/dnssdโ the local administration network directory ๐
And here's the tea: all of these config files get collectively sorted and processed in lexicographic order, no matter which directory they came from. So yes, they're all mixed together in one big alphabetical lineup ๐
But โ and this is important โ files with identical filenames replace each other. Priority goes like this:
- Files in
/etc/have the highest priority ๐ - Files in
/run/take precedence over files with the same name in/usr/lib/๐ฅ
So if you ever need to override a system-supplied config file with your own local one? That's exactly how you do it. Slay ๐
Now, alongside your network service file foo.dnssd, a "drop-in" directory named foo.dnssd.d/ may also exist. Cute, right? ๐
Every file in that directory with the suffix .conf gets parsed after the main file itself is parsed. This is literally so useful when you want to alter or add config settings without having to touch the main config file at all. Obsessed ๐
Heads up bestie: each drop-in file must have appropriate section headers. No headers, no vibes, no parsing. ๐ญ
And it doesn't stop at /etc/systemd/dnssd โ you can also place drop-in .d directories in /usr/lib/systemd/dnssd or /run/systemd/dnssd. The precedence chain goes:
- Drop-in files in
/etc/take precedence over those in/run/ - Which in turn take precedence over those in
/usr/lib/or/usr/local/lib/๐ - And drop-in files under any of these directories take precedence over the main network service file, wherever that main file happens to live ๐
๐ [SERVICE] SECTION OPTIONS ๐
Your network service file contains a [Service] section, and this is where you specify a discoverable network service that gets announced on a local network via Multicast DNS broadcasts ๐กโจ
๐ Name=
An instance name of the network service, as defined in section 4.1.1 of RFC 6763[1]. Like, for example, "webserver" ๐ธ๏ธ
The option supports simple specifier expansion. The following expansions are understood:
โจ Table 1. Specifiers available โจ
okay so these are the little magic tokens that get swapped out when your config gets read. bestie, write them exactly like this, they are case-sensitive and the capital letters are not a typo ๐
%aโ Architecture. A short string identifying the architecture of the local system. A string such asx86,x86-64orarm64. See the architectures defined forConditionArchitecture=insystemd.unit(5)for a full list.%Aโ Operating system image version. The operating system image version identifier of the running system, as read from theIMAGE_VERSION=field of/etc/os-release. If not set, resolves to an empty string. Seeos-release(5)for more information.%bโ Boot ID. The boot ID of the running system, formatted as string. Seerandom(4)for more information.%Bโ Operating system build ID. The operating system build identifier of the running system, as read from theBUILD_ID=field of/etc/os-release. If not set, resolves to an empty string. Seeos-release(5)for more information.%Hโ Host name. The hostname of the running system.%mโ Machine ID. The machine ID of the running system, formatted as string. Seemachine-id(5)for more information.%Mโ Operating system image identifier. The operating system image identifier of the running system, as read from theIMAGE_ID=field of/etc/os-release. If not set, resolves to an empty string. Seeos-release(5)for more information.%oโ Operating system ID. The operating system identifier of the running system, as read from theID=field of/etc/os-release. Seeos-release(5)for more information.%vโ Kernel release. Identical touname -routput.%wโ Operating system version ID. The operating system version identifier of the running system, as read from theVERSION_ID=field of/etc/os-release. If not set, resolves to an empty string. Seeos-release(5)for more information.%Wโ Operating system variant ID. The operating system variant identifier of the running system, as read from theVARIANT_ID=field of/etc/os-release. If not set, resolves to an empty string. Seeos-release(5)for more information.%%โ Single percent sign. Use"%%"in place of"%"to specify a single percent sign.
Added in version 236.
๐ฆ Type=
A type of the network service as defined in the section 4.1.2 of RFC 6763, e.g. "_http._tcp". ๐
Added in version 236.
๐ SubType=
A subtype of the network service as defined in the section 7.1 of RFC 6763, e.g. "_printer". โจ
Added in version 256.
๐ Port=
An IP port number of the network service.
Added in version 236.
๐ฅ Priority=
A priority number set in SRV resource records corresponding to the network service.
Added in version 236.
โญ Weight=
A weight number set in SRV resource records corresponding to the network service.
Added in version 236.
๐ TxtText=
A whitespace-separated list of arbitrary key/value pairs conveying additional information about the named service in the corresponding TXT resource record, e.g. "path=/portal/index.html". Keys and values can contain C-style escape sequences which get translated upon reading configuration files.
This option together with TxtData= may be specified more than once, in which case multiple TXT resource records will be created for the service. If the empty string is assigned to this option, the list is reset and all prior assignments will have no effect. ๐ซถ
Added in version 236.
๐ง TxtData=
A whitespace-separated list of arbitrary key/value pairs conveying additional information about the named service in the corresponding TXT resource record where values are base64-encoded string representing any binary data, e.g. "data=YW55IGJpbmFyeSBkYXRhCg==". Keys can contain C-style escape sequences which get translated upon reading configuration files.
- this one, together with
TxtText=, can be dropped in more than once</p> โ and every time you do, a whole new TXT resource record gets born for the service, fr fr. And if you assign the empty string to it? The list gets reset and every assignment you made before that justโฆ โจ doesn't exist anymore โจ. Poof.
Added in version 236. ๐
๐ธ EXAMPLES ๐ธ
๐ Example 1. HTTP service
Bestie, look at this gorgeous little file:
# /etc/systemd/dnssd/http.dnssd
[Service]
Name=%H
Type=_http._tcp
Port=80
TxtText=path=/stats/index.html t=temperature_sensor
So what this does: it makes the http server running on the host discoverable in the local network โ given MulticastDNS is enabled on the network interface. That's the whole vibe. mDNS on, you're seen. mDNS off, you're a ghost. ๐ป
Now, the utility resolvectl should be able to resolve the service to the host's name, like:
$ 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
literally the whole service, right there, no cap. ๐ญ
And Avahi running on a different host in the same local network should see the service as well, bestie โ it's not just us:
$ 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"]
the way it just shows up in both IPv6 and IPv4?? iconic. ๐
๐ SEE ALSO ๐
systemd(1), systemd-resolved.service(8), resolvectl(1) โ go read those next, they're the besties of this page. ๐ซถ
๐ NOTES ๐
okay that's the whole page, you made it to the end!! ๐ this was written for systemd 262.1, and the page itself is SYSTEMD.DNSSD(5) โ that's the version and the date vibe, bestie, and now you're fully caught up on DNS-SD configs. go forth and advertise your services. slay. ๐
โจ
๐ฆ where this page comes from
- arch rolling: systemd 262.1-1 ยท LGPL-2.1-or-later AND CC0-1.0 AND GPL-2.0-or-later AND MIT-0
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms