Validity of a FQDN with a hostname consisting entirely of numbers
Is a FQDN valid if the hostname component is entirely numeric? It's not something I've come across before and I'm not sure if something like the following is legal:
001.example.com.
I know it's an issue for Windows Servers, but is a purely numeric hostname (001 in this case) ever an issue for *nix servers?
Solution 1:
It is legal in form 001.example.com, you can add a hostname 001 as a record on DNS server and you will be able to ping and work with 001.example.com, I'm not sure if any *nix service will fail to work with that, it is according to standards and they should all support it, but you will have problems when omitting the domain.
$ ping 001.example.com
Pinging 001.example.com [127.0.0.5] with 32 bytes of data:
For instance ping, traceroute and many other tools will for 001 return an IP representation of the decimal number, which in this case is 0.0.0.1
$ ping 001
Pinging 0.0.0.1 with 32 bytes of data: PING: transmit failed. General failure. PING: transmit failed. General failure. PING: transmit failed. General failure. PING: transmit failed. General failure.
Highest number you can go that way is 30064771070 which represents 255.255.255.254
ping 30064771070
Pinging 255.255.255.254 with 32 bytes of data:
$ ping 30064771071 Ping request could not find host 30064771071. Please check the name and try again.
For number 30064771071 it will fail as it represents 255.255.255.255, and for numbers 30064771072 and higher it will resolve to IP if the hostname exists, for smaller numbers it always tries IP representation of the decimal number
$ ping 30064771072
Pinging 30064771072 [127.0.0.4] with 32 bytes of data: Reply from 127.0.0.4: bytes=32 time<1ms TTL=128 Reply from 127.0.0.4: bytes=32 time<1ms TTL=128
There was a similar question on UNIX SE
Solution 2:
No issue at all, it is just common to use more relevant/logical names and preferably letters for hostname
See:
https://www.rfc-editor.org/rfc/rfc1035
http://kb.iu.edu/data/aiuv.html
Hope this helps