D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] /etc/hosts

 

On Thu, Sep 6, 2012 at 12:27 PM, paul sutton wrote:
> My question is does the /etc/hosts file have to use the same hostname as
> the machine its refering to or can this say anything could i replace
> E-machine with desktop for example within the hosts file.
>
> I am under the impression the hostname column simply provides a human
> friendly name to an ip address.

It's that. You can think of it as a way to set local DNS settings,
'overwriting' responses given by your DNS server. Apart from setting
hostnames for local IP addresses, you can do silly pointless things
like make www.google.com point to Microsoft, but it can be useful at
times.

I've used it occasionally to point a domain name that was serving ads
inside a video I was watching to something non-existent, which made
the ads go away.

I've also used it when developing a new website, or one that I was
moving. The domain name didn't yet point to the website, but by
pointing the domain to the new server in the hosts file, I could still
test it by entering the domain in my web browser.

Martijn.

-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq