SYSTEMD.RR(5)

πŸ“¦
version 262.1 Β· 2 versions
, in arch rolling

πŸ’– SYSTEMD.RR(5) πŸ’–

okay bestie, we're doing systemd.rr β€” that's the manual page for Local static DNS resource record definitions. she's giving local DNS queen, she's giving "I don't need a whole DNS server, I just need these records to hit". let's get into it πŸŽ€


✨ SYNOPSIS ✨

/etc/systemd/resolve/static.d/*.rr
/run/systemd/resolve/static.d/*.rr
/usr/local/lib/systemd/resolve/static.d/*.rr
/usr/lib/systemd/resolve/static.d/*.rr

those are the four little spots she hangs out in. drop your files there and she'll find them πŸ¦‹


🌸 DESCRIPTION 🌸

so. *.rr files. what are they for? defining resource record sets (we call 'em "RRsets", cute) that should be resolvable locally. think of the vibe of address records in /etc/hosts (go read hosts(5) for the full lore, iykyk) but for RRsets instead of just addresses. these files get read by systemd-resolved.service(8), and then she uses them to synthesize local responses to local queries that match the RRset you defined. no cap, that's the whole plot πŸ’…

these drop-in files are in JSON format. periodt.

each file can be either of these two things:

  1. a single top-level DNS RR object, or
  2. an array of one or more DNS RR objects.

every RR object has at least a "key" subobject, and that subobject is made of:

  • a "name" string field
  • a "type" integer field (this is the RR type, in numeric form)

and then, depending on which type you picked, the RR object also has these fields:

  • for A/AAAA RRs, the RR object should have an "address" field set to either an IP address formatted as a string, or an array consisting of 4 or 16 8-bit unsigned integers for the IP address. so like, you can spell it out as a string OR as the raw bytes. choose your fighter ✨
  • for PTR/NS/CNAME/DNAME RRs, the RR object should have a "name" field set to the name the record shall point to.

and listen β€” this JSON serialization of DNS RRs matches the one returned by resolvectl. same shape, same energy. πŸ”₯

Currently no other RR types are supported. like. that's it. that's the list. don't come at her with anything else, she's not gonna parse it 😭

🌈 EXAMPLES 🌈

Example 1. Simple A Record

say you want local address lookups for "foobar.example.com" to resolve to the 192.168.100.1 IPv4 address. bestie, you just create /run/systemd/resolve/static.d/foobar_example_com.rr and put this in it:

{
        "key" : {
                "type" : 1,
                "name" : "foobar.example.com"
        },
        "address" : [ 192, 168, 100, 1 ]
}

and that's it. she ate. notice the "type" : 1 β€” that's the numeric RR type for A, and "address" is that 4-integer array form. iconic. πŸ‘‘


πŸ’œ SEE ALSO πŸ’œ


okay that's the whole page, bestie, you're fully caught up, go forth and write local DNS records 🫢

signing off from the systemd 262.1 era β€” this was SYSTEMD.RR(5), mwah πŸ’–βœ¨πŸŽ€

πŸ“¦ 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