Format of TXT Data in DNS Record?

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?


Solution 1:

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.