hosts.xml 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
  4. <!ENTITY % general-entities SYSTEM "../general.ent">
  5. %general-entities;
  6. ]>
  7. <sect1 id="ch-scripts-hosts">
  8. <?dbhtml filename="hosts.html"?>
  9. <title>Customizing the /etc/hosts File</title>
  10. <indexterm zone="ch-scripts-hosts">
  11. <primary sortas="e-/etc/hosts">/etc/hosts</primary>
  12. </indexterm>
  13. <indexterm zone="ch-scripts-hosts">
  14. <primary sortas="d-localnet">localnet</primary>
  15. <secondary>/etc/hosts</secondary></indexterm>
  16. <indexterm zone="ch-scripts-hosts">
  17. <primary sortas="d-network">network</primary>
  18. <secondary>/etc/hosts</secondary></indexterm>
  19. <para>If a network card is to be configured, decide on the IP address,
  20. fully-qualified domain name (FQDN), and possible aliases for use in the
  21. <filename>/etc/hosts</filename> file. The syntax is:</para>
  22. <screen><literal>&lt;IP address&gt; myhost.example.org aliases</literal></screen>
  23. <para>Unless the computer is to be visible to the Internet (i.e.,
  24. there is a registered domain and a valid block of assigned IP
  25. addresses&mdash;most users do not have this), make sure that the IP
  26. address is in the private network IP address range. Valid ranges
  27. are:</para>
  28. <screen><literal>Private Network Address Range Normal Prefix
  29. 10.0.0.1 - 10.255.255.254 8
  30. 172.x.0.1 - 172.x.255.254 16
  31. 192.168.y.1 - 192.168.y.254 24</literal></screen>
  32. <para>x can be any number in the range 16-31. y can be any number in
  33. the range 0-255.</para>
  34. <para>A valid private IP address could be 192.168.1.1. A valid FQDN for this
  35. IP could be lfs.example.org.</para>
  36. <para>Even if not using a network card, a valid FQDN is still required.
  37. This is necessary for certain programs to operate correctly.</para>
  38. <para>Create the <filename>/etc/hosts</filename> file by running:</para>
  39. <screen><userinput>cat &gt; /etc/hosts &lt;&lt; "EOF"
  40. <literal># Begin /etc/hosts (network card version)
  41. 127.0.0.1 localhost
  42. <replaceable>[192.168.1.1]</replaceable> <replaceable>[&lt;HOSTNAME&gt;.example.org]</replaceable> <replaceable>[HOSTNAME]</replaceable>
  43. # End /etc/hosts (network card version)</literal>
  44. EOF</userinput></screen>
  45. <para>The <replaceable>[192.168.1.1]</replaceable> and
  46. <replaceable>[&lt;HOSTNAME&gt;.example.org]</replaceable>
  47. values need to be changed for specific users or requirements (if
  48. assigned an IP address by a network/system administrator and the
  49. machine will be connected to an existing network).</para>
  50. <para>If a network card is not going to be configured, create the
  51. <filename>/etc/hosts</filename> file by running:</para>
  52. <screen role="nodump"><userinput>cat &gt; /etc/hosts &lt;&lt; "EOF"
  53. <literal># Begin /etc/hosts (no network card version)
  54. 127.0.0.1 <replaceable>[&lt;HOSTNAME&gt;.example.org]</replaceable> <replaceable>[HOSTNAME]</replaceable> localhost
  55. # End /etc/hosts (no network card version)</literal>
  56. EOF</userinput></screen>
  57. </sect1>