network.xml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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 sub-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. <para>The following command creates a sample <filename>ipv4</filename> file for
  31. the <emphasis>eth0</emphasis> device:</para>
  32. <screen><userinput>cd /etc/sysconfig/network-devices &amp;&amp;
  33. mkdir ifconfig.eth0 &amp;&amp;
  34. cat &gt; ifconfig.eth0/ipv4 &lt;&lt; "EOF"
  35. <literal>ONBOOT=yes
  36. SERVICE=ipv4-static
  37. IP=192.168.1.1
  38. GATEWAY=192.168.1.2
  39. PREFIX=24
  40. BROADCAST=192.168.1.255</literal>
  41. EOF</userinput></screen>
  42. <para>The values of these variables must be changed in every file to
  43. match the proper setup. If the <envar>ONBOOT</envar> variable is
  44. set to <quote>yes</quote> the network script will bring up the
  45. Network Interface Card (NIC) during booting of the system. If set
  46. to anything but <quote>yes</quote> the NIC will be ignored by the
  47. network script and not brought up.</para>
  48. <para>The <envar>SERVICE</envar> variable defines the method of obtaining the IP
  49. address. The LFS-Bootscripts package has a modular IP assignment format, and
  50. creating additional files in the <filename
  51. class="directory">/etc/sysconfig/network-devices/services</filename> directory
  52. allows other IP assignment methods. This is commonly used for Dynamic Host
  53. Configuration Protocol (DHCP), which is addressed in the BLFS book.</para>
  54. <para>The <envar>GATEWAY</envar> variable should contain
  55. the default gateway IP address, if one is present. If not, then comment out
  56. the variable entirely.</para>
  57. <para>The <envar>PREFIX</envar> variable needs to contain the
  58. number of bits used in the subnet. Each octet in an IP address is 8
  59. bits. If the subnet's netmask is 255.255.255.0, then it is using the
  60. first three octets (24 bits) to specify the network number. If the
  61. netmask is 255.255.255.240, it would be using the first 28 bits.
  62. Prefixes longer than 24 bits are commonly used by DSL and cable-based
  63. Internet Service Providers (ISPs). In this example (PREFIX=24), the netmask
  64. is 255.255.255.0. Adjust according to the specific subnet.</para>
  65. </sect2>
  66. <sect2 id="resolv.conf">
  67. <title>Creating the /etc/resolv.conf File</title>
  68. <indexterm zone="resolv.conf"><primary sortas="e-/etc/resolv.conf">/etc/resolv.conf</primary></indexterm>
  69. <para>If the system is going to be connected to the Internet, it will
  70. need some means of Domain Name Service (DNS) name resolution to
  71. resolve Internet domain names to IP addresses, and vice versa. This is
  72. best achieved by placing the IP address of the DNS server, available
  73. from the ISP or network administrator, into
  74. <filename>/etc/resolv.conf</filename>. Create the file by running the
  75. following:</para>
  76. <screen><userinput>cat &gt; /etc/resolv.conf &lt;&lt; "EOF"
  77. <literal># Begin /etc/resolv.conf
  78. domain {<replaceable>[Your Domain Name]</replaceable>}
  79. nameserver <replaceable>[IP address of your primary nameserver]</replaceable>
  80. nameserver <replaceable>[IP address of your secondary nameserver]</replaceable>
  81. # End /etc/resolv.conf</literal>
  82. EOF</userinput></screen>
  83. <para>Replace <replaceable>[IP address of the
  84. nameserver]</replaceable> with the IP address of the DNS most
  85. appropriate for the setup. There will often be more than one entry
  86. (requirements demand secondary servers for fallback capability). If
  87. you only need or want one DNS server, remove the second
  88. <emphasis>nameserver</emphasis> line from the file. The IP address may
  89. also be a router on the local network.</para>
  90. </sect2>
  91. </sect1>