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

Wed Mar 9 16:06:43 UTC 2011
Robert Spangler <mlists at zoominternet.net>

On Tuesday 08 March 2011 12:39, the following was written:

>  >> 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.
>
>  <snip>
>
>  > 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.
>
>  <snip>
>  Let me expand on the above: if anyone on *any* other machine is trying to
>  connect to that, it won't work. If they try to point a browser to it,
>  unless they've done ssh -X to the server, they'll talk to their *own*
>  machine, and it won't be found.

Let me try another way to explain this to you.

If you try to get to the site xyz.com and you open your browser and type that 
in you are using what to get the ip address of that service?  Correct, DNS, 
as you don't have xyz.com listed in your LOCAL host file.

In DNS the site xyz.com resolves to 1.1.1.1

Now you ssh (ssh -x) into the xyz server. The server has the following in its 
Hosts file;

127.0.0.1       xyz.com

You open a browser the xyz servers X session what is going to resolve for 
xyz.com? Correct, 127.0.0.1 and if the system is configured correctly to 
listen on that address you will connect.

Now lets say that the host file has the following;

127.0.0.1     xyz

You are still logged into the server with your x session going.
Now in your browser you type "xyz".  What address do you get and why?
If you type "xyz.com" into the same browser what address do you get and why?


-- 

Regards
Robert

Linux
The adventure of a lifetime.

Linux User #296285
Get Counted
http://counter.li.org/