network.xml 4.7 KB

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