network.xml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/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 you're going to configure a network
  13. card.</para>
  14. <para>If you don't have any network cards, you are most likely not going to
  15. create any configuration files relating to network cards. If that is the
  16. case, you must remove the <filename class="symlink">network</filename> symlinks from all the
  17. run-level directories
  18. (<filename class="directory">/etc/rc.d/rc*.d</filename>)</para>
  19. <sect2>
  20. <title>Creating network interface configuration files</title>
  21. <para>Which interfaces are brought up and down by the network script depends on
  22. the files in the <filename class="directory">/etc/sysconfig/network-devices</filename> directory. This
  23. directory should contain subdirectories in the form of
  24. <filename>ifconfig.xyz</filename>, where <quote>xyz</quote> is a network
  25. interface name (such as eth0)</para>
  26. <para>If you decide to rename or move this
  27. <filename class="directory">/etc/sysconfig/network-devices</filename> directory,
  28. make sure you update the <filename>/etc/sysconfig/rc</filename> file as well and
  29. update the <quote>network_devices</quote> by providing it with the new path.</para>
  30. <para>Now, new files are created in that directory. The following command
  31. creates a sample <filename>ipv4</filename> file for the
  32. <filename>eth0</filename> device:</para>
  33. <screen><userinput>cd /etc/sysconfig/network-devices &amp;&amp;
  34. mkdir ifconfig.eth0 &amp;&amp;
  35. cat &gt; ifconfig.eth0/ipv4 &lt;&lt; "EOF"
  36. ONBOOT=yes
  37. SERVICE=ipv4-static
  38. IP=192.168.1.1
  39. GATEWAY=192.168.1.2
  40. PREFIX=24
  41. BROADCAST=192.168.1.255
  42. EOF</userinput></screen>
  43. <para>Of course, the values of those variables have to be changed in every file
  44. to match the proper setup. If the ONBOOT variable is set to <quote>yes</quote>,
  45. the network script will bring up the equivalent interface during the booting of
  46. the system. If set to anything but <quote>yes</quote>, the equivalent interface
  47. will be ignored by the network script and not brought up.</para>
  48. <para>The SERVICE entry defines the method of obtaining the IP address. The LFS
  49. bootscripts have a modular IP assignment format, and by creating additional
  50. files in
  51. <filename class="directory">/etc/sysconfig/network-devices/services</filename>,
  52. you can allow other IP assignment methods. This would commonly be used if you
  53. need DHCP, which is addressed in the BLFS book.</para>
  54. <para>Of course, GATEWAY should contain the IP of your default gateway, if you
  55. have one. If not, then don't include the GATEWAY line in the configuration
  56. file.</para>
  57. </sect2>
  58. <sect2 id="resolv.conf">
  59. <title>Creating the /etc/resolv.conf file</title>
  60. <indexterm zone="resolv.conf"><primary sortas="e-/etc/resolv.conf">/etc/resolv.conf</primary></indexterm>
  61. <para>If you're going to be connected to the Internet then most likely you'll
  62. need some means of DNS name resolution to resolve Internet domain names to IP
  63. addresses. This is best achieved by placing the IP address of your assigned DNS
  64. resolver, available from your ISP (Internet Service Provider) or network
  65. administrator, into <filename>/etc/resolv.conf</filename>. Create the file by
  66. running the following:</para>
  67. <screen><userinput>cat &gt; /etc/resolv.conf &lt;&lt; "EOF"
  68. # Begin /etc/resolv.conf
  69. domain {<replaceable>[Your Domain Name]</replaceable>}
  70. nameserver <replaceable>[IP address of your nameserver]</replaceable>
  71. # End /etc/resolv.conf
  72. EOF</userinput></screen>
  73. <para>Of course, replace
  74. <replaceable>[IP address of your nameserver]</replaceable> with the IP address
  75. of the DNS resolver assigned for your use. There will often be more than one
  76. entry (requirements demand secondary servers for fallback capability). The IP
  77. address may even be a router on your local network.</para>
  78. </sect2>
  79. </sect1>