[CentOS] /etc/hosts - hostname alias for 127.0.0.1

Johnny Hughes johnny at centos.org
Tue Mar 8 17:12:32 UTC 2011


On 03/07/2011 02:22 PM, m.roth at 5-cent.us wrote:
> Keith Keller wrote:
>> On Mon, Mar 07, 2011 at 10:34:24AM -0600, Sean Carolan wrote:
>>> Can anyone point out reasons why it might be a bad idea to put this
>>> sort of line in your /etc/hosts file, eg, pointing the FQDN at the
>>> loopback address?
>>>
>>> 127.0.0.1    hostname.domain.com hostname   localhost
>>> localhost.localdomain
>>
>> Would the application work with a hosts entry like this?
>>
>> 127.0.0.1    hostname.dummy   localhost localhost.localdomain
>>
>> (Make sure you pick .dummy so as not to interfere with any other DNS.)
>>
>> In theory you could leave off .dummy, but then you risk hostname being
>> completed with the search domain in resolv.conf, which creates the
>> problems already mentioned with putting hostname.domain.com in
>> /etc/hosts.  (I have not tested this at all!)
> 
> And giving it 127.0.0.1 would tell it others to ignore it, I think. Where
> did your user come up with this idea - clearly, they have *no* clue what
> they're doing, and need at least a brown bag lunch about TCP/IP, and they
> should not be allowed to dictate this. Their "idea" is a bug, and needs to
> be fixed.

It is the default way RHEL and CentOS setup up network connections ...
and except for a few badly behaving applications, things work fine like
that.

(the hostname as 127.0.0.1)

You guys do know that the names in your host file only apply to YOU on
that machine right?  It does not matter if you connect to 127.0.0.1 or
something else UNLESS you specifically listen on a specific IP address
on that machine AND you need to connect to that address from the machine
itself.

This is also the way to go if you are on DHCP and if the address of the
machine might change.

Remember, no machines except that one will refer to it in that way.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 253 bytes
Desc: OpenPGP digital signature
URL: <http://lists.centos.org/pipermail/centos/attachments/20110308/49889682/attachment.sig>


More information about the CentOS mailing list