network.xml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
  3. <!ENTITY % general-entities SYSTEM "../general.ent">
  4. %general-entities;
  5. ]>
  6. <sect1 id="ch-scripts-network">
  7. <title>Configuring the network Script</title>
  8. <?dbhtml filename="network.html"?>
  9. <indexterm zone="ch-scripts-network">
  10. <primary sortas="d-network">network</primary>
  11. <secondary>configuring</secondary></indexterm>
  12. <para>This section only applies if a network card is to be
  13. configured.</para>
  14. <para>If a network card will not be used, there is likely no need to
  15. create any configuration files relating to network cards. If that is
  16. the case, remove the <filename class="symlink">network</filename>
  17. symlinks from all run-level directories (<filename
  18. class="directory">/etc/rc.d/rc*.d</filename>).</para>
  19. <sect2>
  20. <title>Creating Network Interface Configuration Files</title>
  21. <!-- Edit Me -->
  22. <para>Which interfaces are brought up and down by the network script
  23. depends on the files and directories in the <filename
  24. class="directory">/etc/sysconfig/network-devices</filename> hierarchy.
  25. This directory should contain a directory for each interface to be configured,
  26. such as <filename>ifconfig.xyz</filename>, where <quote>xyz</quote> is a
  27. network interface name. Inside this directory would be files defining
  28. the attributes to this interface, such as its IP address(es), subnet
  29. masks, and so forth.</para>
  30. <!-- -->
  31. <para>If the <filename
  32. class="directory">/etc/sysconfig/network-devices</filename> directory
  33. is to be renamed or moved, make sure to edit the
  34. <filename>/etc/sysconfig/rc</filename> file and update the
  35. <quote>network_devices</quote> option by providing it with the new
  36. path.</para>
  37. <para>New files are created in this directory. The following
  38. command creates a sample <filename>ipv4</filename> file for the
  39. <emphasis>eth0</emphasis> device:</para>
  40. <screen><userinput>cd /etc/sysconfig/network-devices &amp;&amp;
  41. mkdir ifconfig.eth0 &amp;&amp;
  42. cat &gt; ifconfig.eth0/ipv4 &lt;&lt; "EOF"
  43. <literal>ONBOOT=yes
  44. SERVICE=ipv4-static
  45. IP=192.168.1.1
  46. GATEWAY=192.168.1.2
  47. PREFIX=24
  48. BROADCAST=192.168.1.255</literal>
  49. EOF</userinput></screen>
  50. <para>The values of these variables must be changed in every file to
  51. match the proper setup. If the <envar>ONBOOT</envar> variable is
  52. set to <quote>yes</quote> the network script will bring up the
  53. Network Interface Card (NIC) during booting of the system. If set
  54. to anything but <quote>yes</quote> the NIC will be ignored by the
  55. network script and not brought up.</para>
  56. <para>The <envar>SERVICE</envar> variable defines the method of
  57. obtaining the IP address. The LFS bootscripts have a modular IP
  58. assignment format, and creating additional files in the <filename
  59. class="directory" condition="html">/etc/sysconfig/network-devices/services</filename>
  60. <filename class="directory" condition="pdf">/etc/sysconfig/network- devices/services</filename>
  61. directory allows other IP assignment methods. This is commonly used
  62. for Dynamic Host Configuration Protocol (DHCP), which is addressed in the BLFS book.</para>
  63. <para>The <envar>GATEWAY</envar> variable should contain
  64. the default gateway IP address, if one is present. If not, then comment out
  65. the variable entirely.</para>
  66. <para>The <envar>PREFIX</envar> variable needs to contain the
  67. number of bits used in the subnet. Each octet in an IP address is 8
  68. bits. If the subnet's netmask is 255.255.255.0, then it is using the
  69. first three octets (24 bits) to specify the network number. If the
  70. netmask is 255.255.255.240, it would be using the first 28 bits.
  71. Prefixes longer than 24 bits are commonly used by DSL- and cable-based
  72. Internet Service Providers (ISPs). In this example (PREFIX=24), the netmask
  73. is 255.255.255.0. Adjust according to the specific subnet.</para>
  74. <beginpage/>
  75. </sect2>
  76. <sect2 id="resolv.conf">
  77. <title>Creating the /etc/resolv.conf File</title>
  78. <indexterm zone="resolv.conf"><primary sortas="e-/etc/resolv.conf">/etc/resolv.conf</primary></indexterm>
  79. <para>If the system is going to be connected to the Internet, it will
  80. need some means of Domain Name Service (DNS) name resolution to
  81. resolve Internet domain names to IP addresses, and vice versa. This is
  82. best achieved by placing the IP address of the DNS server, available
  83. from the ISP or network administrator, into
  84. <filename>/etc/resolv.conf</filename>. Create the file by running the
  85. following:</para>
  86. <screen><userinput>cat &gt; /etc/resolv.conf &lt;&lt; "EOF"
  87. <literal># Begin /etc/resolv.conf
  88. domain {<replaceable>[Your Domain Name]</replaceable>}
  89. nameserver <replaceable>[IP address of your primary nameserver]</replaceable>
  90. nameserver <replaceable>[IP address of your secondary nameserver]</replaceable>
  91. # End /etc/resolv.conf</literal>
  92. EOF</userinput></screen>
  93. <para>Replace <replaceable>[IP address of the
  94. nameserver]</replaceable> with the IP address of the DNS most
  95. appropriate for the setup. There will often be more than one entry
  96. (requirements demand secondary servers for fallback capability). If
  97. you only need or want one DNS server, remove the second
  98. <emphasis>nameserver</emphasis> line from the file. The IP address may
  99. also be a router on the local network.</para>
  100. </sect2>
  101. </sect1>