Dns Domain Name Valid Characters. Neither begin with nor end with a dash -. Begin with a letter or a number and end with a letter or a number.
Formatting domain names for domain name registration For domain name registration a domain name can contain only the characters a-z 0-9 and - hyphen. For example MyDomainUS-ER3 is allowed. But some records have stricter rules for either the owner name andor the resource data RDATA.
The full domain name may not exceed a total length of 253 ASCII characters in its textual representation.
A dot is a reserved character for Top Level Domains TLDs and Sub-Domains. TLDR yes underscore is valid in a CNAME record on both sides read below for why. A full domain name is limited to 255 octets including the separators. The top-level domain name the string after the final period character must begin and end with an alphanumeric character.