What is the benefit of setting your hostname, as opposed to letting DHCP
set it when it logs in?
peace,
Rog
http://www.slammingrooves.com
Registered Linux user #190719
On Thu, 14 Dec 2000, Jim Crossley wrote:
> Hi Geoff.
>
> Geoff Thomas wrote:
> >
> > Where in the startup files is Hostname set? I'd like to permanantly
> > change my hostname. Currently, the hostname is my ISP IP address (???)
> > GT
>
> The hostname is set by the hostname command, /bin/hostname. But usually
> that's done by a startup script (/etc/rc.d/rc.sysinit) that reads the
> contents of a configuration file (/etc/sysconfig/network) that contains
> the name you want. In that file, you should see a HOSTNAME variable.
> Set it to what you like. Keep in mind, however, that if you're
> connecting to your ISP via DHCP (as you likely would with a cable or DSL
> line), you'll save yourself some grief by appending "localdomain" to
> your hostname. So if for example you wanted to name your box Merle, you
> would put this line in /etc/sysconfig/network:
>
> HOSTNAME=merle.localdomain
>
> That should cause your login prompt to "welcome you to merle."
>
> If you have a static IP address, then forget what I just said. :-)
>
> Other questions that begin "where in the startup files...?" can often be
> answered by the following command:
>
> # grep -i "text to search for" $(find /etc/rc.d -type f)
>
> Here's the output for a "hostname" search:
>
> # grep -i hostname $(find /etc/rc.d -type f)
> /etc/rc.d/init.d/mysql: pid_file=$datadir/`hostname`.pid
> /etc/rc.d/rc:# things, such as setting the hostname.
> /etc/rc.d/rc.sysinit:HOSTNAME=`/bin/hostname`
> /etc/rc.d/rc.sysinit:if [ -z "$HOSTNAME" -o "$HOSTNAME" = "(none)" ];
> then
> /etc/rc.d/rc.sysinit: HOSTNAME=localhost
> /etc/rc.d/rc.sysinit:# Set the hostname.
> /etc/rc.d/rc.sysinit:action "Setting hostname ${HOSTNAME}: " hostname
> ${HOSTNAME}
> /etc/rc.d/rc.sysinit: hostname ${HOSTNAME}
> /etc/rc.d/rc.sysinit: # Reset the hostname.
> /etc/rc.d/rc.sysinit: action "Resetting hostname ${HOSTNAME}: "
> hostname ${HOSTNAME}
>
> If you take a closer look at rc.sysinit, you'll see that the file
> /etc/sysconfig/network is "sourced" near the top.
>
> -- Jim
> http://www.lads.com/~jim
>
>
>