According to rfc1035, underscores (
_) are not allowed as part of domain names.
The labels must follow the rules for ARPANET host names. They must start with a letter, end with a letter or digit, and have as interior characters only letters, digits, and hyphen (
-). There are also some restrictions on the length. Labels must be 63 characters or less.
This means domain names like
sub_domain.main-domain.com are invalid.
Special thanks to @jclopezdev for finding this out.