While I was looking on RFCs of DNS because of implementation to check underscore in CNAME records, I found this interesting discussion and RFC with interesting point:


RFC 2181 11. Name syntax: The DNS itself places only one restriction on the particular labels that can be used to identify resource records. That one restriction relates to the length of the label and the full name. The length of any one label is limited to between 1 and 63 octets. A full domain name is limited to 255 octets (including the separators). The zero length full name is defined as representing the root of the DNS tree, and is typically written and displayed as ".". Those restrictions aside, any binary string whatever can be used as the label of any resource record. Similarly, any binary string can serve as the value of any record that includes a domain name as some or all of its value (SOA, NS, MX, PTR, CNAME, and any others that may be added). Implementations of the DNS protocols must not place any restrictions on the labels that can be used. In particular, DNS servers must not refuse to serve a zone because it contains labels that might not be acceptable to some DNS client programs. A DNS server may be configurable to issue warnings when loading, or even to refuse to load, a primary zone containing labels that might be considered questionable, however this should not happen by default.

So my question is - if I understant it correctly, does it mean, we can use in DNS records like MX, CNAME, etc. something like this?

If we ask for: (imagine there can be any binary string)


Can this return similar mashup of characters (eg. binary strig?) Is it allowed?

Of course, I am not asking about "hostnames" rules and about "preffered" naming conventions, but about "allowed" use of characters in DNS.

  • DNS is 8-bit clean you can use any character for labels that are not hostnames. – Patrick Mevzek May 7 '18 at 13:30

There are three things to consider:

  1. The RFC standards — which you don't seem to care about as you don't want to know about preffered naming conventions and such.
  2. The implementation of the DNS server you're using — regardless of the RFCs, whether or not you can put binary data in the DNS namespace depends on whether the vendor (BIND, NSD...) supports these characters in their software. In order to get a definitive answer on this you'll have to read their documentation or, more likely, browse their source code.
  3. The implementation of the DNS client you're using — if you want to store binary data in the DNS name space, and not the data RDATA records, the client will need to support this as well.
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.