hosts.xml 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.5/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>IP_address 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>&lt;192.168.1.1&gt;</replaceable> <replaceable>&lt;HOSTNAME.example.org&gt;</replaceable> <replaceable>[alias1] [alias2 ...]</replaceable>
  43. # End /etc/hosts (network card version)</literal>
  44. EOF</userinput></screen>
  45. <para>The <replaceable>&lt;192.168.1.1&gt;</replaceable> and
  46. <replaceable>&lt;HOSTNAME.example.org&gt;</replaceable>
  47. values need to be changed for specific uses or requirements (if
  48. assigned an IP address by a network/system administrator and the
  49. machine will be connected to an existing network). The optional alias
  50. name(s) can be omitted.</para>
  51. <para>If a network card is not going to be configured, create the
  52. <filename>/etc/hosts</filename> file by running:</para>
  53. <screen role="nodump"><userinput>cat &gt; /etc/hosts &lt;&lt; "EOF"
  54. <literal># Begin /etc/hosts (no network card version)
  55. 127.0.0.1 <replaceable>&lt;HOSTNAME.example.org&gt;</replaceable> <replaceable>&lt;HOSTNAME&gt;</replaceable> localhost
  56. # End /etc/hosts (no network card version)</literal>
  57. EOF</userinput></screen>
  58. </sect1>