12

The TXT record for my domain currently has a legal disclaimer and terms and conditions. They were added some time ago due to spammers and other miscreants (to give me legal traction if I ever needed it).

I need to add a more information which is distinct from the first. According to RFC 1035, 3.3.14:

3.3.14. TXT RDATA format


    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    /                   TXT-DATA                    /
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

where:

TXT-DATA        One or more <character-string>s.

TXT RRs are used to hold descriptive text.  The semantics of the text
depends on the domain where it is found.

How, precisely, is the second (or third) string added? What is/are the delimiters of TXT-DATA?

Or do I add a second (or third) TXT record? Are multiple TXT records even allowed?

1 Answer 1

13

For named, most popular DNS server, you can use any of the following forms to create longer TXT record:

  • One string, one line:

    name IN TXT "very long string here"
    
  • Many strings in one line:

    name IN TXT "very long " "string here"
    
  • Many strings, one per line, enclosed in parentheses:

    name IN TXT ("very long "
                 "string here")
    

For multi-string forms, strings are simply concatenated together verbatim (all examples above will give identical outcome).

Note that most DNS tools don't explicitly support creating multiple TXT records against the same name. Also, in real life, most of TXT records are used for SPF or DKIM. Even if you somehow manage to create multiple TXT records against same name, for SPF it would be illegal, and as such, not recommended.

Also, look at this from different point of view. For example, you can have multiple A records for a given name, which is used to specify that your website has more than one server. But, according to DNS rules, it must automatically randomize their order on DNS query (a.k.a. round robin), such that most client requests are split evenly between all IP addresses.

If you create multiple TXT records, that means DNS must also randomize them, and must give them to you in NO particular order. That would be very awkward: your text will read either as

"very long ", "string here"

or as

"string here", "very long "

In other words, don't attempt to do that - just create single multi-line TXT record and call it a day.

10
  • 2
    I think it’s easy and perfectly valid to have multiple TXT records for the same name, using one of them for SPF. RFC 7208 section 4.5 states that records not starting with v=spf1 should be ignored.
    – Martin
    Nov 26, 2015 at 18:08
  • 1
    The strings are neither concatenated, nor do they result in multiple TXT records - there can be multiple txt records with multiple separate strings, and concatenating them would be wrong for some applications. Apr 12, 2018 at 8:34
  • 1
    Strings can be concatenated, but strings in TXT records aren't concatenated, and concatenating them is generally wrong, and no known implementation does that. The strings in a TXT record are also NEVER randomized, and will basically never read as in your example. Your answer answers the question about syntax, but is wrong, confusing or misleading in almost every other detail. Apr 13, 2018 at 10:57
  • 1
    @CoolAJ86 there is no delimiter, dns uses counted strings, so the strings can contain any byte values, including zero, although some very buggy implementations such as microsoft dns might corrupt them in transit. Apr 13, 2018 at 10:59
  • 1
    Just to clarify this further - TXT records can contain multiple string fragments, and these string fragments are not concatenated or reordered but stay distinct when transferred over the network. The examples given in this answer do not give identical outcome as trying it out will reveal. Apr 13, 2018 at 11:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .