In the Ubuntu Server Installer, we are precluded from placing a number as the first character in a hostname. However, once installed, we can issue a hostname command to rename the server to have a numeric prefix. Is there a reason for this limitation?

As an example, in the installer, I could create a hostname of


but NOT


I can, however, create a server with a name of


then, in the CLI, rename it to


Please advise why this limitation is in place and if there are any caveats to working around it.


Historic reasons, probably.

RFC 952, published in 1985, with the title of DOD INTERNET HOST TABLE SPECIFICATION mandates that hostnames contains letters (a-z) and digits (0-9), and cannot start with a digit:

  1. 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". (See RFC-921, "Domain Name System Implementation Schedule", for background). 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. A host which serves as a GATEWAY should have "-GATEWAY" or "-GW" as part of its name. Hosts which do not serve as Internet gateways should not use "-GATEWAY" and "-GW" as part of their names. A host which is a TAC should have "-TAC" as the last part of its host name, if it is a DoD host. Single character names or nicknames are not allowed.

(My emphasis).

This was changed in RFC 1123, four years later:

The syntax of a legal Internet host name was specified in RFC-952 [DNS:4]. One aspect of host name syntax is hereby changed: the restriction on the first character is relaxed to allow either a letter or a digit. Host software MUST support this more liberal syntax.

So whilst the latter is allowable today, it has not always been so, and I'm guessing it's an convention that is still held by quite a few today, which is why programmers has (wrongly) enforced this.

IMO it could be submitted as a bug towards the installer.

It will work on modern systems, and you should see no issues on modern platforms that conforms to modern DNS standards.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.