tags:

views:

301

answers:

2

Can subdomains have underscore "_" in them?

+2  A: 

From this forum post, it may be possible, but you are encouraged to use hyphens instead: http://www.dnlodge.com/forums/domains/2050/

Jon
It's "possible" but invalid.
John Feminella
It is perfectly valid. See my answer.
bortzmeyer
+6  A: 

Most answers given here are false. It is perfectly legal to have an underscore in a domain name. Let me quote the standard, RFC 2181, section 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. [...] 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.

See also the original DNS specification, RFC 1034, section 3.5 "Preferred name syntax" but read it carefully.

Domains with underscores are very common in the wild. Check _jabber._tcp.gmail.com or _sip._udp.apnic.net.

Other RFC mentioned here deal with different things. The original question was for domain names. If the question is for host names (or for URLs, which include a host name), then this is different, the relevant standard is RFC 1123, section 2.1 "Host Names and Numbers" which limits host names to letters-digits-hyphen.

bortzmeyer
+1 for the difference between "domain names" and "host names"
Alnitak
You're right. I'll remove my answer.
John Feminella