2004-05-03 11:59:46 +01:00
<?xml version="1.0" encoding="ISO-8859-1"?>
< !DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
2004-01-27 22:29:49 +00:00
<sect1 id= "ch-scripts-hosts" >
2001-02-15 15:26:52 +00:00
<title > Creating the /etc/hosts file</title>
2004-05-03 11:59:46 +01:00
<?dbhtml filename="hosts.html"?>
<indexterm zone= "ch-scripts-hosts" > <primary sortas= "e-/etc/hosts" > /etc/hosts</primary> </indexterm>
<indexterm zone= "ch-scripts-hosts" >
<primary sortas= "d-localnet" > localnet</primary>
<secondary > /etc/hosts</secondary> </indexterm>
<indexterm zone= "ch-scripts-hosts" >
<primary sortas= "d-network" > network</primary>
<secondary > /etc/hosts</secondary> </indexterm>
2001-02-15 15:26:52 +00:00
2001-08-29 20:50:53 +01:00
<para > If a network card is to be configured, you have to decide on the
2004-06-19 17:54:58 +01:00
IP-address, FQDN and possible aliases for use in the <filename > /etc/hosts</filename> file. The
2002-01-15 21:36:04 +00:00
syntax is:</para>
2001-07-22 20:45:10 +01:00
2004-01-18 01:07:23 +00:00
<screen > < IP address> myhost.example.org aliases</screen>
2001-07-22 20:45:10 +01:00
2004-06-19 17:54:58 +01:00
<para > Unless your computer is to be visible to the Internet (e.g., you have a
registered domain and a valid block of assigned IP addresses - most of us don't
have this) you should make sure that the IP-address is in the private network
2001-07-22 20:45:10 +01:00
IP-address range. Valid ranges are:</para>
2003-10-10 00:22:07 +01:00
<screen > Class Networks
2001-02-15 15:26:52 +00:00
A 10.0.0.0
B 172.16.0.0 through 172.31.0.0
2003-10-10 00:22:07 +01:00
C 192.168.0.0 through 192.168.255.0</screen>
2001-07-22 20:45:10 +01:00
<para > A valid IP address could be 192.168.1.1. A valid FQDN for this IP could
2004-06-19 17:54:58 +01:00
be www.linuxfromscratch.org (not recommended as this is a valid registered domain
address and could cause your domain name server problems).</para>
2001-07-22 20:45:10 +01:00
2001-08-29 20:50:53 +01:00
<para > If you aren't going to use a network card, you still need to
2002-01-15 21:36:04 +00:00
come up with a FQDN. This is necessary for certain programs to operate
correctly.</para>
2001-07-22 20:45:10 +01:00
2002-01-15 21:36:04 +00:00
<para > If a network card is not going to be configured, create the
<filename > /etc/hosts</filename> file by running:</para>
2001-07-22 20:45:10 +01:00
2004-06-19 17:54:58 +01:00
<screen > <userinput > cat > /etc/hosts < < "EOF"
2001-02-15 15:26:52 +00:00
# Begin /etc/hosts (no network card version)
2004-06-19 17:54:58 +01:00
127.0.0.1 <replaceable > [< value of HOSTNAME> .example.org]</replaceable> <replaceable > [value of HOSTNAME]</replaceable> localhost
2001-02-15 15:26:52 +00:00
# End /etc/hosts (no network card version)
2004-06-19 17:54:58 +01:00
EOF</userinput> </screen>
2001-07-22 20:45:10 +01:00
2002-01-15 21:36:04 +00:00
<para > If a network card is to be configured, create the
<filename > /etc/hosts</filename> file by running:</para>
2001-07-22 20:45:10 +01:00
2004-06-19 17:54:58 +01:00
<screen > <userinput > cat > /etc/hosts < < "EOF"
2001-02-15 15:26:52 +00:00
# Begin /etc/hosts (network card version)
2004-01-18 01:07:23 +00:00
127.0.0.1 localhost
2004-06-19 17:54:58 +01:00
<replaceable > [192.168.1.1]</replaceable> <replaceable > [< value of HOSTNAME> .example.org]</replaceable> <replaceable > [value of HOSTNAME]</replaceable>
2001-02-15 15:26:52 +00:00
# End /etc/hosts (network card version)
2004-06-19 17:54:58 +01:00
EOF</userinput> </screen>
2001-02-15 15:26:52 +00:00
2004-06-19 17:54:58 +01:00
<para > Of course, the <replaceable > [192.168.1.1]</replaceable> and <replaceable > [< value of HOSTNAME> .example.org]</replaceable>
2003-08-26 22:21:44 +01:00
have to be changed to your liking (or requirements if assigned an IP-address
by a network/system administrator and this machine is planned to be connected
to an existing network).</para>
2001-02-15 15:26:52 +00:00
</sect1>