2001-06-30 00:30:11 +01:00
|
|
|
<sect1 id="ch07-hosts">
|
2001-02-15 15:26:52 +00:00
|
|
|
<title>Creating the /etc/hosts file</title>
|
2001-09-26 01:35:10 +01:00
|
|
|
<?dbhtml filename="hosts.html" dir="chapter07"?>
|
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
|
2002-01-15 21:36:04 +00:00
|
|
|
IP-address, FQDN and possible aliases for use in the /etc/hosts file. The
|
|
|
|
syntax is:</para>
|
2001-07-22 20:45:10 +01:00
|
|
|
|
2002-01-15 21:38:10 +00:00
|
|
|
<para><screen><IP address> myhost.mydomain.org aliases</screen></para>
|
2001-07-22 20:45:10 +01:00
|
|
|
|
2001-08-29 20:50:53 +01:00
|
|
|
<para>You should made 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>
|
|
|
|
|
|
|
|
<para><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
|
2001-07-22 20:45:10 +01:00
|
|
|
C 192.168.0.0 through 192.168.255.0</screen></para>
|
|
|
|
|
|
|
|
<para>A valid IP address could be 192.168.1.1. A valid FQDN for this IP could
|
2002-05-23 18:01:16 +01:00
|
|
|
be www.linuxfromscratch.org.</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
|
|
|
|
|
|
|
<para><screen><userinput>cat > /etc/hosts << "EOF"</userinput>
|
2001-02-15 15:26:52 +00:00
|
|
|
# Begin /etc/hosts (no network card version)
|
|
|
|
|
|
|
|
127.0.0.1 www.mydomain.com <value of HOSTNAME> localhost
|
|
|
|
|
|
|
|
# End /etc/hosts (no network card version)
|
2001-07-22 20:45:10 +01:00
|
|
|
<userinput>EOF</userinput></screen></para>
|
|
|
|
|
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
|
|
|
|
|
|
|
<para><screen><userinput>cat > /etc/hosts << "EOF"</userinput>
|
2001-02-15 15:26:52 +00:00
|
|
|
# Begin /etc/hosts (network card version)
|
|
|
|
|
|
|
|
127.0.0.1 localhost.localdomain localhost
|
|
|
|
192.168.1.1 www.mydomain.org <value of HOSTNAME>
|
|
|
|
|
|
|
|
# End /etc/hosts (network card version)
|
2001-07-22 20:45:10 +01:00
|
|
|
<userinput>EOF</userinput></screen></para>
|
2001-02-15 15:26:52 +00:00
|
|
|
|
2001-08-29 20:50:53 +01:00
|
|
|
<para>Of course, the 192.168.1.1 and www.mydomain.org have to be changed
|
|
|
|
to your liking (or requirements if assigned an IP-address by a network/system
|
2002-03-17 19:04:09 +00:00
|
|
|
administrator and this machine is planned to be connected to an existing
|
2001-08-29 20:50:53 +01:00
|
|
|
network).</para>
|
2001-02-15 15:26:52 +00:00
|
|
|
|
|
|
|
</sect1>
|
|
|
|
|