80 lines
4.4 KiB
HTML
80 lines
4.4 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
|
|
<!Converted with LaTeX2HTML 95.1 (Fri Jan 20 1995) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds >
|
|
<HEAD>
|
|
<TITLE>4.10.2 Setting the hostname</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
<meta name="description" value="4.10.2 Setting the hostname">
|
|
<meta name="keywords" value="gs">
|
|
<meta name="resource-type" value="document">
|
|
<meta name="distribution" value="global">
|
|
<P>
|
|
<BR> <HR><A NAME=tex2html4178 HREF="node191.html"><IMG ALIGN=BOTTOM ALT="next" SRC="next_motif.gif"></A> <A NAME=tex2html4176 HREF="node188.html"><IMG ALIGN=BOTTOM ALT="up" SRC="up_motif.gif"></A> <A NAME=tex2html4172 HREF="node189.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif"></A> <A NAME=tex2html4180 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif"></A> <A NAME=tex2html4181 HREF="node250.html"><IMG ALIGN=BOTTOM ALT="index" SRC="index_motif.gif"></A> <BR>
|
|
<B> Next:</B> <A NAME=tex2html4179 HREF="node191.html">4.11 What To Do </A>
|
|
<B>Up:</B> <A NAME=tex2html4177 HREF="node188.html">4.10 Miscellaneous Tasks</A>
|
|
<B> Previous:</B> <A NAME=tex2html4173 HREF="node189.html">4.10.1 System startup files</A>
|
|
<BR> <HR> <P>
|
|
<H2><A NAME=SECTION006102000000000000000>4.10.2 Setting the hostname</A></H2>
|
|
<A NAME=secsethostname> </A>
|
|
<A NAME=5055> </A>
|
|
<A NAME=5095> </A>
|
|
In a networked
|
|
environment, the hostname is used to uniquely identify a particular
|
|
machine, while in a standalone environment the hostname just gives
|
|
the system personality and charm. It's like naming a pet: you can
|
|
always address to your dog as ``The dog,'' but it's much more interesting
|
|
to assign the dog a name such as Spot or Woofie.
|
|
<P>
|
|
Setting the system's hostname is a simple matter of using the
|
|
<tt>hostname</tt> command. If you are on a network, your
|
|
hostname should be the full hostname of your machine, such as
|
|
<tt>goober.norelco.com</tt>. If you are not on a network of any kind,
|
|
you can choose an arbitrary host and domainname, such as
|
|
<tt>loomer.vpizza.com</tt>, <tt>shoop.nowhere.edu</tt>, or <tt>floof.org</tt>.
|
|
<P>
|
|
When setting the hostname, the hostname must appear in the file
|
|
<tt>/etc/hosts</tt>, which assigns an IP address to each host. Even
|
|
if your machine is not on a network, you should include your own hostname
|
|
in <tt>/etc/hosts</tt>.
|
|
<P>
|
|
For example, if you are not on a TCP/IP network, and your hostname
|
|
is <tt>floof.org</tt>, simply include the following line in <tt>/etc/hosts</tt>:
|
|
<P><TT> 127.0.0.1 floof.org localhost
|
|
<P></TT>
|
|
This assigns your hostname, <tt>floof.org</tt>, to the loopback address
|
|
127.0.0.1 (used if you're not on a network). The <tt>localhost</tt>
|
|
alias is also assigned to this address.
|
|
<P>
|
|
If you are on a TCP/IP network, however, your real IP address and hostname
|
|
should appear in <tt>/etc/hosts</tt>. For example, if your hostname is
|
|
<tt>goober.norelco.com</tt>, and your IP address is 128.253.154.32, add
|
|
the following line to <tt>/etc/hosts</tt>:
|
|
<P><TT> 128.253.154.32 goober.norelco.com
|
|
<P></TT>
|
|
<P>
|
|
If your hostname does not appear in <tt>/etc/hosts</tt>, you will
|
|
not be able to set it.
|
|
<P>
|
|
To set your hostname, simply use the <tt>hostname</tt> command. For
|
|
example, the command
|
|
<P><TT> # <em>hostname -S goober.norelco.com</em>
|
|
<P></TT>
|
|
sets the hostname to <tt>goober.norelco.com</tt>. In most cases, the
|
|
<tt>hostname</tt> command is executed from one of the system startup
|
|
files, such as <tt>/etc/rc</tt> or <tt>/etc/rc.local</tt>. Edit these
|
|
two files and change the <tt>hostname</tt> command found there to
|
|
set your own hostname; upon rebooting the system the hostname will
|
|
be set to the new value.
|
|
<P>
|
|
<BR> <HR><A NAME=tex2html4178 HREF="node191.html"><IMG ALIGN=BOTTOM ALT="next" SRC="next_motif.gif"></A> <A NAME=tex2html4176 HREF="node188.html"><IMG ALIGN=BOTTOM ALT="up" SRC="up_motif.gif"></A> <A NAME=tex2html4172 HREF="node189.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif"></A> <A NAME=tex2html4180 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif"></A> <A NAME=tex2html4181 HREF="node250.html"><IMG ALIGN=BOTTOM ALT="index" SRC="index_motif.gif"></A> <BR>
|
|
<B> Next:</B> <A NAME=tex2html4179 HREF="node191.html">4.11 What To Do </A>
|
|
<B>Up:</B> <A NAME=tex2html4177 HREF="node188.html">4.10 Miscellaneous Tasks</A>
|
|
<B> Previous:</B> <A NAME=tex2html4173 HREF="node189.html">4.10.1 System startup files</A>
|
|
<BR> <HR> <P>
|
|
<BR> <HR>
|
|
<P><ADDRESS>
|
|
<I>Matt Welsh <BR>
|
|
mdw@sunsite.unc.edu</I>
|
|
</ADDRESS>
|
|
</BODY>
|