correct syntax inside /etc/hosts ?

  • Follow


Hi,

i'm a little worried about the "recommended" syntax inside /etc/hosts

 From Oracle Support i got the notice to have the entries in the 
following way :

192.168.10.10    hostname.domainname hostname alias1 alias2

but from our support engineers the following :

192.168.10.10   hostname hostname.domain alias1 alias2



What is now the correct order ?????  of hostname <-> hostname.domainname


Regards
Frank
0
Reply Frank 2/25/2004 9:13:23 AM

Frank Zimmer wrote:
> Hi,
> 
> i'm a little worried about the "recommended" syntax inside /etc/hosts
> 
>  From Oracle Support i got the notice to have the entries in the 
> following way :
> 
> 192.168.10.10    hostname.domainname hostname alias1 alias2
> 
> but from our support engineers the following :
> 
> 192.168.10.10   hostname hostname.domain alias1 alias2
> 
> 
> 
> What is now the correct order ?????  of hostname <-> hostname.domainname
> 
> 
> Regards
> Frank

Assuming that in the above, "domainname" from the first example and 
"domain" from the second are equivalent, then these two examples 
themselves should be equivalent. I have seen products that only respond 
to the first "name" entry on the line previously though, (st'wange that 
Oracle SQL*Net seems to come to mind IIRC), so I would tend towards 
Oracle's recommendation, and having been a support-type person for many 
years, I would not believe anything that a support engineer tells you 
;-) Even though the second exmaple would be my choice.

Ultimately if your apps only work with one syntax or the other, then the 
decision is made. "Correctness" must stand aside...

0
Reply Beardy 2/25/2004 10:02:55 AM



On Wed, 25 Feb 2004, Frank Zimmer wrote:

> Hi,
>
> i'm a little worried about the "recommended" syntax inside /etc/hosts
>
>  From Oracle Support i got the notice to have the entries in the
> following way :
>
> 192.168.10.10    hostname.domainname hostname alias1 alias2
>
> but from our support engineers the following :
>
> 192.168.10.10   hostname hostname.domain alias1 alias2
>
>
>
> What is now the correct order ?????  of hostname <-> hostname.domainname

With a properly configured dns you shouldnt need to add the domain in the
hosts file at all.

The manual states that its supposed to be one line per ip
with the official name first and the nicknames following

from manpage
--------------
     The hosts file has one entry for each  IP  address  of  each
     host.  If  a host has more than one IP address, it will have
     one entry for each, on consecutive lines. The format of each
     line is:

          IP-address official-host-name nicknames...
--------------

I've seen people adding them one per line too, still working.

i.e.

aa.bb.cc.dd hostname-1
aa.bb.cc.dd nickname-1

I wouldnt recommend that though since it goes agains the manual.

/Johan A

0
Reply Mr 2/25/2004 2:26:38 PM

Sendmail looks for a FQDN in the host file to start without complaining.

mike


On Wed, 25 Feb 2004 15:26:38 +0100, Mr. Johan Andersson <johan@solace.mh.se> wrote:
> 
> 
> 
> 
> On Wed, 25 Feb 2004, Frank Zimmer wrote:
> 
>> Hi,
>>
>> i'm a little worried about the "recommended" syntax inside /etc/hosts
>>
>>  From Oracle Support i got the notice to have the entries in the
>> following way :
>>
>> 192.168.10.10    hostname.domainname hostname alias1 alias2
>>
>> but from our support engineers the following :
>>
>> 192.168.10.10   hostname hostname.domain alias1 alias2
>>
>>
>>
>> What is now the correct order ?????  of hostname <-> hostname.domainname
> 
> With a properly configured dns you shouldnt need to add the domain in the
> hosts file at all.
> 
> The manual states that its supposed to be one line per ip
> with the official name first and the nicknames following
> 
> from manpage
> --------------
>      The hosts file has one entry for each  IP  address  of  each
>      host.  If  a host has more than one IP address, it will have
>      one entry for each, on consecutive lines. The format of each
>      line is:
> 
>           IP-address official-host-name nicknames...
> --------------
> 
> I've seen people adding them one per line too, still working.
> 
> i.e.
> 
> aa.bb.cc.dd hostname-1
> aa.bb.cc.dd nickname-1
> 
> I wouldnt recommend that though since it goes agains the manual.
> 
> /Johan A
> 


-- 
 Michael Vore, W3CCV       M-ASA [Ka8]; WHIRL, ABC; CAW, CW, AAW
      http://mike.vorefamily.net/omw   <- NEW * * Turned Wood items
      http://mike.vorefamily.net/twr   <-The weblog
0
Reply Mike 2/25/2004 6:02:22 PM

In article <c1hp1n$1j3em3$1@ID-105697.news.uni-berlin.de>,
 Frank Zimmer <frank.zimmer@euroscript.lu> wrote:

> Hi,
> 
> i'm a little worried about the "recommended" syntax inside /etc/hosts
> 
>  From Oracle Support i got the notice to have the entries in the 
> following way :
> 
> 192.168.10.10    hostname.domainname hostname alias1 alias2
> 
> but from our support engineers the following :
> 
> 192.168.10.10   hostname hostname.domain alias1 alias2
> 
> 
> 
> What is now the correct order ?????  of hostname <-> hostname.domainname

The only difference is what name is returned as the primary name by 
gethostbyaddr().  I.e. when you translate the address back to a name, it 
will return the first name on the line as the name, and the others as 
aliases.

All of the names are treated equivalently when translating name->address.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
0
Reply Barry 2/25/2004 10:06:42 PM

Frank Zimmer <frank.zimmer@euroscript.lu> wrote:
> Hi,
> 
> i'm a little worried about the "recommended" syntax inside /etc/hosts
> 
> From Oracle Support i got the notice to have the entries in the 
> following way :
> 
> 192.168.10.10    hostname.domainname hostname alias1 alias2

That's also what the man page says, albeit for hosts with multiple
IP addresses:

     The format of each line is:

          IP-address official-host-name nicknames...

     Items are separated by any number of SPACE and/or TAB  char-
     acters.  The  first item on a line is the host's IP address.
     The second entry is the  host's  official  name.  Subsequent
     entries  on the same line are alternative names for the same
     machine, or "nicknames." Nicknames are optional.

I've always used this format, too. IWFM might not be what you want
to read, though.

> but from our support engineers the following :
> 
> 192.168.10.10   hostname hostname.domain alias1 alias2

This just offends my sense of order.

Kurt
-- 
The bogosity meter just pegged.
0
Reply kwall 2/26/2004 4:09:10 AM


On Wed, 25 Feb 2004, Mike Vore wrote:

> Sendmail looks for a FQDN in the host file to start without complaining.
>
> mike
>

Oh?

I though it did a resolve lookup, and since that starts before sendmail,
with a properly set up dns it would resolve.

I dont think mine complains, but I have to check that next time i reboot,
it sure doesnt now when i just stop and start it.

/Johan A

0
Reply Mr 2/26/2004 10:21:27 AM

6 Replies
679 Views

(page loaded in 0.05 seconds)

Similiar Articles:













7/22/2012 8:16:41 AM


Reply: