Hacker News new | ask | show | jobs
by dc396 16 days ago
"The length limit of a DNS TXT record is 255 characters."

Nope. That's the maximum length of a TXT record string. TXT record strings with the same owner name get concatenated together. The maximum for a TXT record is 65,280 octets (which may or may not translate into characters depending on encoding).

Also, you probably want to think about the implications of caching and TTL.

1 comments

When you say "get concatenated together" are you perhaps thinking of how multiple SPF records get concatenated by MTA's? Because in ISC dig they are multiple distinct records, which is fine too.

    finger nochan.net
    "bing bing bong."
    "Catching up on HN"
No. It's been a while, but I believe if you use multiple TXTs, resolvers can reorder them as they see fit. For example,

label IN TXT "foo " IN TXT "bar " IN TXT "baz"

You can have any number of TXT RRs with a label, allowing up to 65,280 bytes. However, resolvers can reorder those 3 TXT RRs.

If you put the text strings in quotes in a single TXT RR, e.g.:

label IN TXT "foo " "bar " "baz"

You'll get "foo bar baz" and each of the strings can be up to 255 bytes. I think (but I'm too lazy to verify) that the maximum length of a concatenated string is implementation dependent.

    for  i in $(seq 100);do echo -en '0';done
    0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

    test            69s     in      txt     "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"

    nsd-checkzone nochan.net ./nochan.net.zone
    zone nochan.net is ok

    nsd-control reload nochan.net
    ok

    # from my laptop
    dig -t txt +short test.nochan.net
    "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
Still shows up as three quoted strings 100 characters long each but not 300 0's meaning no concatenation at least not when using dig which is what this thread is about.