Page tree
Skip to end of metadata
Go to start of metadata

The "Hosts file" format can severely impact the Simple Diagnostic Agent (SDA), Diagnostics Agent, the SAP Host Agent, connectivity between Managed Systems and Focused Run or Solution Manager

More information on the note : 2926115 and note : 611361


Where is the /etc/hosts file located ?

The location of the "Hosts file's" is the following:

  • On Unix/Linux: /etc/hosts
  • On Windows: C:\Windows\System32\drivers\etc\hosts



Do we have a maximum total amount of entries for the /etc/hosts file ?

No,

But more lines are existing in the /etc/hosts file the more difficult it will be to maintain the system and the network configuration.

Because the "Hosts file" format can severely impact the Simple Diagnostic Agent (SDA), Diagnostics Agent, the SAP Host Agent and the connectivity between Managed Systems and Solution Manager

An /etc/hosts file with a maximum of 10 lines is strongly advised 

We also strongly recommend you to use DNS instead of using the /etc/hosts file itself for large networks.


For more information following the information in MCSA/MCSE 70-254: Monitoring and Troubleshooting Network Activity :

  • Hosts files are very effective in small environments with a limited number of hosts; however, the vast number of Internet resources led to the development of DNS.



What is the information field order for the /etc/hosts file standard format ?

The Mandatory Information field 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 field order :

#IP                                      Full Qualified Domain Name                              Hostname

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

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


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

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

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

# Incorrect format with incorrect line field 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 field order

The correct field 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 specify 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]


What is the correct way to maintain your Physical, Virtual and Logical hosts in the /etc/hosts file ?

The requirement regarding /etc/hosts file regarding Physical/Virtual and Logical is the following

Each hosts Physical Virtual or Logical have to be define unique in the /etc/hosts file 

For more information see : SAP Note 962955

# Correct format regarding order Physical, Virtual and Logical Host :

#IP                                 Full Qualified Domain Name                      Hostname

Each host is define with unique IP FQDN and Hostname


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

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

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

# Incorrect format regarding order with Physical, Virtual, Logical Host :

#IP                               Full Qualified Domain Name                       Hostname                                                            

                           

This example is strictly forbidden you cannot have Physical, Virtual, Logical host with the same IP address


# Incorrect format regarding order with Physical, Virtual, Logical Host :

#IP                                   Full Qualified Domain Name                         Hostname                                                            

               

This example is strictly forbidden you cannot have Physical Virtual Logical host with same IP and define on the same /etc/hosts file line



Shall "IP addresses", "FQDNs" and "Hostnames" be unique in the /etc/hosts file ?

Yes, all mentioned "IP addresses", "FQDNs" and "Hostnames" have to be unique in the host file to make it readable for SAP Server, it is not possible to have two times the same entry in the /etc/hosts file

# Correct format regarding duplicate :

# Unique IP                                   Unique Full Qualified Domain Name                         Unique Hostname

You can see on this example there is not any duplicate entries in the /etc/hosts file


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

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

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

# Incorrect format with duplicate IP address :

#IP                                        Full Qualified Domain Name              Hostname

This example is strictly forbidden you cannot have duplicate IP address


# Incorrect format with duplicate FQDN :

#IP                                          Full Qualified Domain Name               Hostname

This example is strictly forbidden you cannot have duplicate FQDN


# Incorrect Format with duplicate Hostname :

#IP                                        Full Qualified Domain Name               Hostname

This example is strictly forbidden you cannot have duplicate Hostname


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

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

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

For more information please verify the "hosts" file standard format defined as per RFC952 (Hosts Table Convention).

  • The RFC for protocols specify 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]



Does two different FQDN for the same IP address is authorized ?

 No. You can’t associate two different FQDNs to the same IP address. It will lead to an incorrect resolution. 

The /etc/hosts file will not be able to contain' s 2 different FQDNs for the same IP address following the standard format


# Correct format regarding FQDN :

#IP                                  Full Qualified Domain Name                       Hostname


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

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

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

# Incorrect format regarding FQDN :

#IP                           1 Full Qualified Domain Name                              2 Full Qualified Domain Name                                 Hostname

             

This example is strictly forbidden you cannot have 2 FQDN for the same IP address, each IP must have only one FQDN referenced

Review the IP address allocation with your network administrator


For RedHat and Suse linux /etc/hosts "Example format" specificity what should we do ?

For RedHat and Suse Linux Os /etc/hosts "Example line" format specificity :

  • 127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
  • ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

This format is incorrect because of the 2 FQDN's and incorrect ordering

Please correct the format as following or simply remove the two "Example lines" to avoid any network connectivity issue

  • ##127.0.0.1  localhost.localdomain localhost
  • ##::1         localhost.localdomain localhost 

How do we apply modification of the /etc/hosts file ?

Any modification of the "hosts" file will require an OS restart, or at least a restart of the Network Service and the Diagnostic Agent.

You can :

  • Restart the host completely, by rebooting it

or at least

  • Restart the Network Service following this command :
    • On Unix/Linux: restart /etc/init.d/networking
    • On Windows: restart the network service

Remember to perform both actions, elsewise the modification won’t be taken into account

  • No labels