hosts.xml 1.9 KB

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