Thursday 4 July 2024

Information's orders in the /etc/hosts file ?

 The Mandatory Information order on the /etc/hosts file are the following :

1st position: IP address 

2nd position: FQDN (Full Qualified Domain Name)

3rd position: Short hostname


Correct format with correct line information order :

#IP                                      Full Qualified Domain Name                              Hostname

ALL the line on the /etc/hosts file have to be maintained following this order

If one line is formatted incorrectly the /etc/hosts file will be unreadable


=======================================================================================        Incorrect /etc/hosts file Format    =========================

=======================================================================

Incorrect format with incorrect line order in the hosts file :

#IP                                              Hostname                                      Full Qualified Domain Name                                    

(This example is strictly forbidden you cannot have the IP Hostname and FQDN in this order)

(The correct order is IP FQDN Hostname)

==================       See Also      =======================================


For more information please verify the Standard format definition :

The "hosts" file standard format is defined as per RFC952 (Hosts Table Convention).

  • The RFC for protocols specifies these labels must only contain the ASCII letters a through z (in a case-insensitive manner), the digits 0 through 9, and the hyphen-minus character ('-'). The original specification of hostnames in RFC 952 disallowed labels starting with a digit or with a hyphen character and end with a hyphen. However, a subsequent specification (RFC 1123) permits hostname labels to start with digits. No other symbols, punctuation characters, or whitespace are permitted. Internationalized domain names are stored in the Domain Name System as ASCII strings using Punycode transcription.[4]