[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: Hostname "Chicken and Egg"
- From: Bob McClure Jr <robertmcclure earthlink net>
- To: Getting started with Red Hat Linux <redhat-install-list redhat com>
- Subject: Re: Hostname "Chicken and Egg"
- Date: Thu, 16 Dec 2004 17:09:45 -0600
On Thu, Dec 16, 2004 at 03:01:55PM -0800, Bob Kinney wrote:
> Happy Holidays all--
>
> I'm running RH9, and recently switched from being directly connected to
> the internet (dhcp giving me a publicly routed address) to being behind
> a router.
>
> I reconfigured my IP address to be a static, private one now, and my
> hostname now comes up as "localhost.localdomain". I'm trying to name the
> host "vectra".
>
> Looking at the man page for hostname, it says that:
> " The host name is usually set once at system startup in
> /etc/rc.d/rc.inet1 or /etc/init.d/boot (normally by reading the con-
> tents of a file which contains the host name, e.g. /etc/hostname)."
>
> Although the files mentioned aren't there, I found in /etc/rc.sysinit
> a section that seems to set the hostname by *calling* /bin/hostname.
> >>
> HOSTNAME=`/bin/hostname`
> if [ -f /etc/sysconfig/network ]; then
> . /etc/sysconfig/network
> else
> NETWORKING=no
> fi
> if [ -z "$HOSTNAME" -o "$HOSTNAME" = "(none)" ]; then
> HOSTNAME=localhost
> fi
> <<
>
>
> [root localhost init.d]# cat /etc/sysconfig/network
> NETWORKING=yes
> HOSTNAME=localhost.localdomain
> [root localhost init.d]#
>
>
> It would seem that the hostname is being set either by the
> /etc/sysconfig/network file, or by the fallout case listed in
> /etc/rc.sysinit (if -z $HOSTNAME ...).
>
> I don't know why the hostname command would fail:
>
> [root localhost init.d]# cat /etc/hostname
> vectra
> [root localhost init.d]#
>
> Also, what does the line ". /etc/sysconfig/network" do?
> Is "." (dot) a command?
>
> --bk
Yes. "." means to "source", that is to execute in the current shell.
/etc/sysconfig/network is nothing but a shell script that sets
environment variables (well, shell variables, actually), one of which
is $HOSTNAME. So edit the file so that it has your desire host name
and then reboot.
Cheers,
--
Bob McClure, Jr. Bobcat Open Systems, Inc.
robertmcclure earthlink net http://www.bobcatos.com
Grace happens.
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]