You are not logged in.

#1 2007-01-06 20:08:19

molinero
Member
From: Copenhagen/Denmark
Registered: 2004-09-19
Posts: 110

Confused about /etc/hosts and hostname

This is rather  :oops: but I can't figure this out.

I've set up dns so that my domainname points to my ip adress and so that mail.mydomain.dk also points to me. I have a small webserver.

I really do not know how to setup the /etc/hosts file and what should the hostname be?

I've installed hula and it works on localhost.

my domainname is masu.dk

Could someone give me an example of how to write things in the /etc/hosts file?

Should I set the servers hostname to masu?

Offline

#2 2007-01-06 22:20:38

noriko
Member
From: In My Mind
Registered: 2006-06-09
Posts: 535
Website

Re: Confused about /etc/hosts and hostname

it can be whatever you like...

i.e

127.0.0.1   athlin athlin.xp sky localhost
192.66.0.16 athlin.lan tserver1 wserver fserver mserver
192.66.0.31 pentium1 tserver2
192.66.0.32 mobile1
192.66.0.1 gateway

the first bit is just an ip, the rest(space separated) are names u wish to identify this ip address by... i.e on localhost 127.0.0.1 ; i have setup sky and athlin.xp names to direct me to a usable local website developement/test environment to go with their respective apache virt hosts..

i also have a number of other computer's ip address from my lan this way for example i wanna go to the router/'s management cosole i can use the name gateway instead of having to type out the full ip address


The.Revolution.Is.Coming - - To fight, To hunger, To Resist!

Offline

#3 2007-01-06 23:40:05

Snarkout
Member
Registered: 2005-11-13
Posts: 542

Re: Confused about /etc/hosts and hostname

I don't quite understand what you're asking.  If you have setup an external DNS server to point yourdomain.com and mail.yourdomain.com at you IP, and you have an MX record pointing to mail.yourdomain.com, you should be good.  /etc/hosts is mostly for local network IPs and/or aliases, and (in general) shouldn't affect services you are running on your box.  Even if what you mean is that you're running DNS on this box, /etc/hosts isn't going to affect queries made anywhere but from this box which (by default at least) will look in /etc/hosts before a DNS lookup.

Or did you mean something different?


Unthinking respect for authority is the greatest enemy of truth.
-Albert Einstein

Offline

#4 2007-01-07 00:19:03

mr.MikyMaus
Member
From: disabled
Registered: 2006-03-31
Posts: 285

Re: Confused about /etc/hosts and hostname

As Snarkout wrote, the /etc/hosts file is, simply said, nothing but a list of IP adresses and according domain names.

Say for example, you have in /etc/hosts line like

127.0.0.1   www.google.com

If you then run Firefox on that box and point it to www.google.com, it will, in fact, be pointet to localhost.

But the /etc/hosts file will not (should not) affect any incoming connections, it is only for local programs to bypass or override DNS lookup.

-miky


What happened to Arch's KISS? systemd sure is stupid but I must have missed the simple part ...

... and who is general Failure and why is he reading my harddisk?

Offline

#5 2007-01-07 10:55:13

molinero
Member
From: Copenhagen/Denmark
Registered: 2004-09-19
Posts: 110

Re: Confused about /etc/hosts and hostname

Ahh okay - so the file works just like a local dns lookup table? That makes sense.

And yes I have setup an external DNS to point to my domain and a MX record pointing to mail.mydomain.

Thanks for the help  big_smile

Offline

Board footer

Powered by FluxBB