Ubuntu – Can’t resolve domain names starting with a dash

url

I (and many other users) can't access pages which URL contains a dash in its subdomain ; example : fragmented—.deviantart.com

  • Checked with other OS : there's a page really dwelling here. And you can verify that deviantart normally sends you a 404 page.
  • Checked with many web browsers : it doesn't work with ubuntu neither debian.

Best Answer

There is a Launchpad Bug (#668926) on the subject. A similar case (just the name starts with the hyphen).

Following the discussion the problem seems to be rooted in different levels of standards compliance.

Linux seems to follow strictly RFC 952:

A "name" (Net, Host, Gateway, or Domain name) is a text string up to 24 characters drawn from the alphabet (A-Z), digits (0-9), minus sign (-), and period (.). Note that periods are only allowed when they serve to delimit components of "domain style names". [...] No blank or space characters are permitted as part of a name. No distinction is made between upper and lower case. The first character must be an alpha character. The last character must not be a minus sign or period.

Whereas there are standards that are more relaxed about the domain naming conventions. In Comment #7 further RFCs are listed, that contain rules more loose than 952 (and some seem to contradict each other).

It's strange while you can nslookup such names, you cannot ping or wget them.

The next surprising thing is if you add this host name to /etc/hosts/ you can ping it, even browse the website. Add the following line to /etc/hosts (sudo YOUR-FAVOURITE-TEXT-EDITOR /etc/hosts, but be careful, create a backup first.):

199.15.160.100  fragmented---.deviantart.com

Now fire up your favourite browser and follow http://fragmented---.deviantart.com/.