hosts.xml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <sect1 id="ch07-hosts">
  2. <title>Creating the /etc/hosts file</title>
  3. <para>If a network card is to be configured, a user has to decide on the
  4. IP-address, FQDN and possible aliases for use in the /etc/hosts file. An
  5. example is:</para>
  6. <para><screen>&lt;my-IP&gt; myhost.mydomain.org aliases</screen></para>
  7. <para>It should made sure that the IP-address is in the private network
  8. IP-address range. Valid ranges are:</para>
  9. <para><screen> Class Networks
  10. A 10.0.0.0
  11. B 172.16.0.0 through 172.31.0.0
  12. C 192.168.0.0 through 192.168.255.0</screen></para>
  13. <para>A valid IP address could be 192.168.1.1. A valid FQDN for this IP could
  14. be www.linuxfromscratch.org</para>
  15. <para>If a user is not going to use a network card, he still needs to
  16. come up with a FQDN. This is necessary for programs like Sendmail to operate
  17. correctly (in fact; Sendmail won't run when it can't determine the FQDN).</para>
  18. <para>If a network card is not going to be configured, a new file
  19. <filename>/etc/hosts</filename> is created by running:</para>
  20. <para><screen><userinput>cat &gt; /etc/hosts &lt;&lt; "EOF"</userinput>
  21. # Begin /etc/hosts (no network card version)
  22. 127.0.0.1 www.mydomain.com &lt;value of HOSTNAME&gt; localhost
  23. # End /etc/hosts (no network card version)
  24. <userinput>EOF</userinput></screen></para>
  25. <para>If a network card is to be configured, a new file
  26. <filename>/etc/hosts</filename> is created by running:</para>
  27. <para><screen><userinput>cat &gt; /etc/hosts &lt;&lt; "EOF"</userinput>
  28. # Begin /etc/hosts (network card version)
  29. 127.0.0.1 localhost.localdomain localhost
  30. 192.168.1.1 www.mydomain.org &lt;value of HOSTNAME&gt;
  31. # End /etc/hosts (network card version)
  32. <userinput>EOF</userinput></screen></para>
  33. <para>Of course, the 192.168.1.1 and www.mydomain.org have to be changed to the
  34. users
  35. liking (or requirements if assigned an IP-address by a network/system
  36. administrator and this machine is planned to be
  37. connected to that network).</para>
  38. </sect1>