1 <sect1 id="ch07-hosts">
2 <title>Creating the /etc/hosts file</title>
3 <?dbhtml filename="hosts.html" dir="chapter07"?>
5 <para>If a network card is to be configured, you have to decide on the
6 IP-address, FQDN and possible aliases for use in the /etc/hosts file. The
9 <para><screen><IP address> myhost.mydomain.org aliases</screen></para>
11 <para>You should made sure that the IP-address is in the private network
12 IP-address range. Valid ranges are:</para>
14 <para><screen> Class Networks
16 B 172.16.0.0 through 172.31.0.0
17 C 192.168.0.0 through 192.168.255.0</screen></para>
19 <para>A valid IP address could be 192.168.1.1. A valid FQDN for this IP could
20 be www.linuxfromscratch.org.</para>
22 <para>If you aren't going to use a network card, you still need to
23 come up with a FQDN. This is necessary for certain programs to operate
26 <para>If a network card is not going to be configured, create the
27 <filename>/etc/hosts</filename> file by running:</para>
29 <para><screen><userinput>cat > /etc/hosts << "EOF"</userinput>
30 # Begin /etc/hosts (no network card version)
32 127.0.0.1 www.mydomain.com <value of HOSTNAME> localhost
34 # End /etc/hosts (no network card version)
35 <userinput>EOF</userinput></screen></para>
37 <para>If a network card is to be configured, create the
38 <filename>/etc/hosts</filename> file by running:</para>
40 <para><screen><userinput>cat > /etc/hosts << "EOF"</userinput>
41 # Begin /etc/hosts (network card version)
43 127.0.0.1 localhost.localdomain localhost
44 192.168.1.1 www.mydomain.org <value of HOSTNAME>
46 # End /etc/hosts (network card version)
47 <userinput>EOF</userinput></screen></para>
49 <para>Of course, the 192.168.1.1 and www.mydomain.org have to be changed
50 to your liking (or requirements if assigned an IP-address by a network/system
51 administrator and this machine is planned to be connected to an existing