hosts.xml 2.0 KB

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