Is the hostname case sensitive? Is
Does it depend on the DNS used? Are there differences between Win/Mac/Unix systems?
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
Names resolved from DNS are case insensitive. This is important to prevent confusion. If it was case sensitive then we would have eight variants of .com (.com, .Com, .cOm, .COm, .coM, .CoM, .cOM, and .COM). Country codes would have four.
If name resolution is case-sensitive for Ping it is not being done by DNS.
I've just had this here at work. DNS should be case insensitive.... the RFC (RFC 4343 - Domain Name System (DNS) Case Insensitivity Clarification) specifies that but doesn't say it MUST be lower case.
So we had the pleasure of troubleshooting a host that didn't resolve things right for our internal domain "t.local"
p123$ ping p123-db.t.local PING p123-db.t.local (192.168.106.175) 56(84) bytes of data. ....works ok p123$ ping P123-dB.T.lOcal ping: unknown host P123-dB.T.lOcal
Why bother resolving the mixed case? Because that's what tcpdump was showing as the DNS query because that's what the running software was asking for. pgbouncer was configured to use "p123-db" in its config, and resolv.conf specified a search domain of "t.local" So what is mixing up the case?
Turns out glibc was toggling the case randomly. The process is called "0x20 padding" and was first described in 2008 in "Use of Bit 0x20 in DNS Labels to Improve Transaction Identity" https://datatracker.ietf.org/doc/html/draft-vixie-dnsext-dns0x20-00
The main purpose is to increase the entropy so that its harder to fake a reply - the question's case must match the case of the answer.
A good discussion may be found here. https://developers.google.com/speed/public-dns/docs/security?csw=1#randomize_case
Separately, we run powerDNS internally, and that does lookups against a database. For years, noone has used a hostname or FQDN in the t.local domain with a capital letter, so we never noticed that our internal domain was case sensitive.
Was fixed by some tweaks in the query, but this would have broken the 0x20 mixed case lookups as above - the client may require the answer is returned in the same case as it was requested.
Short answer: DNS should not be case sensitive, but the question and answer will need to be identical case, in the future.
I just finished troubleshooting an issue on an embedded SE Linux device where host name resolution was exhibiting case sensitivity.
"ping MYHOST" would ping to 127.0.0.1, whereas "ping myhost" would ping the correct IP Address.
nslookup produced correct results for both uppercase and lowercase, indicating that the DNS server was not at fault.
But unlike nslookup, which ignores the cache, "getent hosts MYHOST" output "0.0.0.0", and "getent hosts myhost" output the correct IP Address.
So nscd is apparently case sensitive. Calling "nscd -i hosts" to clear the cache fixed the issue.
The MYHOST in (uppercase) ended up cached with 0.0.0.0 due to a process trying to establish a connection to MYHOST before the DNS entry was created, which happens when the remote device gets its DHCP assignment.
As BillThor mentioned, it's not case sensitive at the DNS or netbios resolution level.
The various OSes won't have a problem with the different casing either.
However, the applications may be aware of them. For example, the web platforms on the various environments can check for case sensitivity. It's more common now for search engine optimization (SEO) reasons to watch for different casing and redirect. That's all up to the application though so the answer there is that it varies.
For the 'most part' the hostname isn't a case sensitive concern at the application level either though.