network.xml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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">/etc/sysconfig/network-devices/services</filename>
  60. directory allows other IP assignment methods. This is commonly used
  61. for Dynamic Host Configuration Protocol (DHCP), which is addressed in the BLFS book.</para>
  62. <para>The <envar>GATEWAY</envar> variable should contain
  63. the default gateway IP address, if one is present. If not, then comment out
  64. the variable entirely.</para>
  65. <para>The <envar>PREFIX</envar> variable needs to contain the
  66. number of bits used in the subnet. Each octet in an IP address is 8
  67. bits. If the subnet's netmask is 255.255.255.0, then it is using the
  68. first three octets (24 bits) to specify the network number. If the
  69. netmask is 255.255.255.240, it would be using the first 28 bits.
  70. Prefixes longer than 24 bits are commonly used by DSL- and cable-based
  71. Internet Service Providers (ISPs). In this example (PREFIX=24), the netmask
  72. is 255.255.255.0. Adjust according to the specific subnet.</para>
  73. </sect2>
  74. <sect2 id="resolv.conf">
  75. <title>Creating the /etc/resolv.conf File</title>
  76. <indexterm zone="resolv.conf"><primary sortas="e-/etc/resolv.conf">/etc/resolv.conf</primary></indexterm>
  77. <para>If the system is going to be connected to the Internet, it will
  78. need some means of Domain Name Service (DNS) name resolution to
  79. resolve Internet domain names to IP addresses, and vice versa. This is
  80. best achieved by placing the IP address of the DNS server, available
  81. from the ISP or network administrator, into
  82. <filename>/etc/resolv.conf</filename>. Create the file by running the
  83. following:</para>
  84. <screen><userinput>cat &gt; /etc/resolv.conf &lt;&lt; "EOF"
  85. <literal># Begin /etc/resolv.conf
  86. domain {<replaceable>[Your Domain Name]</replaceable>}
  87. nameserver <replaceable>[IP address of your primary nameserver]</replaceable>
  88. nameserver <replaceable>[IP address of your secondary nameserver]</replaceable>
  89. # End /etc/resolv.conf</literal>
  90. EOF</userinput></screen>
  91. <para>Replace <replaceable>[IP address of the
  92. nameserver]</replaceable> with the IP address of the DNS most
  93. appropriate for the setup. There will often be more than one entry
  94. (requirements demand secondary servers for fallback capability). If
  95. you only need or want one DNS server, remove the second
  96. <emphasis>nameserver</emphasis> line from the file. The IP address may
  97. also be a router on the local network.</para>
  98. </sect2>
  99. </sect1>