[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to configure hostname and /etc/hosts?



> On Fri, 24 Feb 2006, Matus UHLAR - fantomas wrote:
> > I have a notebook which I often move between sites and ocasionally use
> > without network connection.
> > I have set up hostname to 'fnote' and set up /etc/hosts this way:
> > 
> > 127.0.0.1       localhost       fnote.local     fnote
> > 
> > This means, that "fnote" resolves along with "fnote.local" and of course
> > "localhost" to 127.0.0.1, while 127.0.0.1 resolves to "localhost" -

On 24.02 00:39, Alvin Oga wrote:
> it should be:
> 
> 127.0.0.1	localhost.localdomain localhost
> 
> w.x.y.z		fnote.debian.org      fnote  www  oranythingelseyouwant
> 
> but real dns men, put w.xy.z and its reverse into a dns file and only
> define localhost in /etc/hosts  

I do NOT have any primary nor own IP address, and I don't know when will I
get what IP, I can't just put an IP into /etc/hosts - when connecting to
different networks, ONLY IP that I can't get assigned is the localhost -
127.0.0.1

Of course that would be different if that was my home machine statically
connected to a network there I could use one of private subnets, however In
places I use to go, I get IPs from such ranges.

> > I've logically expected that 127.0.0.1 should always resolve to "localhost"
> > and vice versa. (searching google supports this opinion)
> 
> that doesn't mean its correct

What is correct then? use random IP and reconfigure notebook whenever it's
used in a network? yah...

> > However, when programming a script that uses `hostname -s` convention to
> > get
> 
> bingo ... along with hostname -f, hostname -d might return values
> you might not want if the wrong entries is used in /etc/hosts or dns

It is what I can expect in such case. However, as long as the man page says:

       -s, --short
              Display the short host name. This is the host name  cut  at the
              first dot.

people would expext it's the "host name" (as returneg by gethostname) and
not "fqdn" cut, right?

-- 
Matus UHLAR - fantomas, uhlar@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
BSE = Mad Cow Desease ... BSA = Mad Software Producents Desease



Reply to: