network.xml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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>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>Configuring default gateway</title>
  21. <para>If you're on a network you may need to set up the default gateway (a node on your network that provides access to other networks) for
  22. this machine. This is done by adding the proper values to the
  23. /etc/sysconfig/network file by running the following:</para>
  24. <screen><userinput>cat &gt;&gt; /etc/sysconfig/network &lt;&lt; "EOF"</userinput>
  25. GATEWAY=192.168.1.2
  26. GATEWAY_IF=eth0
  27. <userinput>EOF</userinput></screen>
  28. <para>The values for GATEWAY and GATEWAY_IF need to be changed to match
  29. your network setup. GATEWAY contains the IP address of the default
  30. gateway, and GATEWAY_IF contains the network interface through which the
  31. default gateway can be reached.</para>
  32. </sect2>
  33. <sect2>
  34. <title>Creating network interface configuration files</title>
  35. <para>Which interfaces are brought up and down by the network script depends on
  36. the files in the /etc/sysconfig/network-devices directory. This
  37. directory should contain files in the form of ifconfig.xyz, where xyz is a
  38. network interface name (such as eth0 or eth0:1)</para>
  39. <para>If you decide to rename or move this /etc/sysconfig/network-devices
  40. directory, make sure you update the /etc/sysconfig/rc file as well and
  41. update the network_devices by providing it with the new path.</para>
  42. <para>Now, new files are created in that directory.
  43. The following command creates a sample ifconfig.eth0 file:</para>
  44. <screen><userinput>cat &gt; /etc/sysconfig/network-devices/ifconfig.eth0 &lt;&lt; "EOF"</userinput>
  45. ONBOOT=yes
  46. SERVICE=static
  47. IP=192.168.1.1
  48. NETMASK=255.255.255.0
  49. BROADCAST=192.168.1.255
  50. <userinput>EOF</userinput></screen>
  51. <para>Of course, the values of those variables have to be changed
  52. in every file to match the proper setup. If the ONBOOT variable is set
  53. to yes, the network script will bring up the equivalent NIC (Network Interface Card)
  54. during the booting of the system.
  55. If set to anything but yes, the equivalent NIC will be ignored by the network script
  56. and not brought up.</para>
  57. <para>The SERVICE entry defines the method of obtaining the IP address.
  58. The LFS bootscripts have a modular IP assignment format, and by creating
  59. additional files in /etc/sysconfig/network-devices/services, you can allow
  60. other IP assignment methods. This would commonly be used if you need DHCP,
  61. which is addressed in the BLFS book.</para>
  62. </sect2>
  63. <sect2>
  64. <title>Creating the /etc/resolv.conf file</title>
  65. <para>If you're going to be connected to the Internet then most likely you'll
  66. need some means of DNS name resolution to resolve Internet domain names to IP
  67. addresses. This is best achieved by placing the IP address of your DNS, available from your ISP (Internet Service Provider) or network administrator,
  68. into <filename>/etc/resolv.conf</filename>. Create the file by running the
  69. following:</para>
  70. <screen><userinput>cat &gt; /etc/resolv.conf &lt;&lt; "EOF"</userinput>
  71. # Begin /etc/resolv.conf
  72. nameserver &lt;IP address of your nameserver&gt;
  73. # End /etc/resolv.conf
  74. <userinput>EOF</userinput></screen>
  75. <para>Of course, replace &lt;IP address of your nameserver&gt; with the IP
  76. address of the DNS most appropriate for your setup. There will often be
  77. more than one entry (requirements demand secondary servers for fallback capability). The IP address may even be a router on your local network.</para>
  78. </sect2>
  79. </sect1>