Pasted below this question is a sample of a
/etc/hosts file from a Linux (CentOS) and a Windows machine. The Linux file has two tabbed entries after the IP address (that is localhost.localdomain localhost) and Windows has only one. If I want to edit the hosts file in Windows to have the machine name (etest) instead of localhost, I simply replace the word localhost with the machine name I want. The machine need not be part of a domain.
In a Linux machine, the two entries
localhost seems to indicate that I will need the machine to be part of a domain. Is this true?
Can I simply edit both entries to
etest so that it will read:
127.0.0.1 etest etest
or is it required that I substitute one entry with a domain name?
Additionally, please let me know what the second line of the
/etc/hosts file on the Linux machine is for.
::1 localhost6.localdomain6 localhost6
hosts file on a Linux machine:
# Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost ::1 localhost6.localdomain6 localhost6
hosts file on a windows machine:
# Copyright (c) 1993-1999 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # # 126.96.36.199 rhino.acme.com # source server # 188.8.131.52 x.acme.com # x client host 127.0.0.1 localhost