1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3CR2//EN" "http://www.docbook.org/xml/4.3CR2/docbookx.dtd">
3 <sect1 id="ch07-hosts">
4 <title>Creating the /etc/hosts file</title>
5 <?dbhtml filename="hosts.html"?>
7 <para>If a network card is to be configured, you have to decide on the
8 IP-address, FQDN and possible aliases for use in the /etc/hosts file. The
11 <screen><IP address> myhost.mydomain.org aliases</screen>
13 <para>You should make sure that the IP-address is in the private network
14 IP-address range. Valid ranges are:</para>
16 <screen> Class Networks
18 B 172.16.0.0 through 172.31.0.0
19 C 192.168.0.0 through 192.168.255.0</screen>
21 <para>A valid IP address could be 192.168.1.1. A valid FQDN for this IP could
22 be www.linuxfromscratch.org.</para>
24 <para>If you aren't going to use a network card, you still need to
25 come up with a FQDN. This is necessary for certain programs to operate
28 <para>If a network card is not going to be configured, create the
29 <filename>/etc/hosts</filename> file by running:</para>
31 <screen><userinput>cat > /etc/hosts << "EOF"</userinput>
32 # Begin /etc/hosts (no network card version)
34 127.0.0.1 <value of HOSTNAME>.mydomain.com <value of HOSTNAME> localhost
36 # End /etc/hosts (no network card version)
37 <userinput>EOF</userinput></screen>
39 <para>If a network card is to be configured, create the
40 <filename>/etc/hosts</filename> file by running:</para>
42 <screen><userinput>cat > /etc/hosts << "EOF"</userinput>
43 # Begin /etc/hosts (network card version)
45 127.0.0.1 localhost.localdomain localhost
46 192.168.1.1 <value of HOSTNAME>.mydomain.org <value of HOSTNAME>
48 # End /etc/hosts (network card version)
49 <userinput>EOF</userinput></screen>
51 <para>Of course, the 192.168.1.1 and <value of HOSTNAME>.mydomain.org
52 have to be changed to your liking (or requirements if assigned an IP-address
53 by a network/system administrator and this machine is planned to be connected
54 to an existing network).</para>