source: chapter07/network.xml@ 3890f5a

6.0
Last change on this file since 3890f5a was 3890f5a, checked in by Manuel Canales Esparcia <manuel@…>, 20 years ago

Added <literal> tags into cat ... EOF blocks.

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/testing/BOOK@4102 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 4.8 KB
Line 
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
10<indexterm zone="ch-scripts-network">
11<primary sortas="d-network">network</primary>
12<secondary>configuring</secondary></indexterm>
13
14<para>This section only applies if a network card is to be
15configured.</para>
16
17<para>If a network card will not be used, there is likely no need to
18create any configuration files relating to network cards. If that is
19the case, remove the <filename class="symlink">network</filename>
20symlinks from all run-level directories (<filename
21class="directory">/etc/rc.d/rc*.d</filename>).</para>
22
23<sect2>
24<title>Creating Network Interface Configuration Files</title>
25
26<para>Which interfaces are brought up and down by the network script
27depends on the files in the <filename
28class="directory">/etc/sysconfig/network-devices</filename> directory.
29This directory should contain files in the form of
30<filename>ifconfig.xyz</filename>, where <quote>xyz</quote> is a
31network interface name (such as eth0 or eth0:1).</para>
32
33<para>If the <filename
34class="directory">/etc/sysconfig/network-devices</filename> directory
35is to be renamed or moved, make sure to edit the
36<filename>/etc/sysconfig/rc</filename> file and update the
37<quote>network_devices</quote> option by providing it with the new
38path.</para>
39
40<para>New files are created in this directory. The following
41command creates a sample <filename>ipv4</filename> file for the
42<emphasis>eth0</emphasis> device:</para>
43
44<screen><userinput>cd /etc/sysconfig/network-devices &amp;&amp;
45<literal>mkdir ifconfig.eth0 &amp;&amp;
46cat &gt; ifconfig.eth0/ipv4 &lt;&lt; "EOF"
47ONBOOT=yes
48SERVICE=ipv4-static
49IP=192.168.1.1
50GATEWAY=192.168.1.2
51PREFIX=24
52BROADCAST=192.168.1.255</literal>
53EOF</userinput></screen>
54
55<para>The values of these variables must be changed in every file to
56match the proper setup. If the <emphasis>ONBOOT</emphasis> variable is
57set to <quote>yes</quote> the network script will bring up the
58Network Interface Card (NIC) during booting of the system. If set
59to anything but <quote>yes</quote> the NIC will be ignored by the
60network script and not brought up.</para>
61
62<para>The <emphasis>SERVICE</emphasis> variable defines the method of
63obtaining the IP address. The LFS bootscripts have a modular IP
64assignment format, and creating additional files in the <filename
65class="directory">/etc/sysconfig/network-devices/services</filename>
66directory allows other IP assignment methods. This is commonly used
67for Dynamic Host Configuration Protocol (DHCP), which is addressed in the BLFS book.</para>
68
69<para>The <emphasis>GATEWAY</emphasis> variable should contain
70the default gateway IP address, if one is present. If not, then comment out
71the variable entirely.</para>
72
73<para>The <emphasis>PREFIX</emphasis> variable needs to contain the
74number of bits used in the subnet. Each octet in an IP address is 8
75bits. If the subnet's netmask is 255.255.255.0, then it is using the
76first three octets (24 bits) to specify the network number. If the
77netmask is 255.255.255.240, it would be using the first 28 bits.
78Prefixes longer than 24 bits are commonly used by DSL- and cable-based
79Internet Service Providers (ISPs). In this example (PREFIX=24), the netmask
80is 255.255.255.0. Adjust according to the specific subnet.</para>
81
82</sect2>
83
84<sect2 id="resolv.conf">
85<title>Creating the /etc/resolv.conf File</title>
86<indexterm zone="resolv.conf"><primary sortas="e-/etc/resolv.conf">/etc/resolv.conf</primary></indexterm>
87
88<para>If the system is going to be connected to the Internet, it will
89need some means of Domain Name Service (DNS) name resolution to
90resolve Internet domain names to IP addresses, and vice versa. This is
91best achieved by placing the IP address of the DNS server, available
92from the ISP or network administrator, into
93<filename>/etc/resolv.conf</filename>. Create the file by running the
94following:</para>
95
96<screen><userinput>cat &gt; /etc/resolv.conf &lt;&lt; "EOF"
97<literal># Begin /etc/resolv.conf
98
99domain {<replaceable>[Your Domain Name]</replaceable>}
100nameserver <replaceable>[IP address of your primary nameserver]</replaceable>
101nameserver <replaceable>[IP address of your secondary nameserver]</replaceable>
102
103# End /etc/resolv.conf</literal>
104EOF</userinput></screen>
105
106<para>Replace <replaceable>[IP address of the
107nameserver]</replaceable> with the IP address of the DNS most
108appropriate for the setup. There will often be more than one entry
109(requirements demand secondary servers for fallback capability). If
110you only need or want one DNS server, remove the second
111<emphasis>nameserver</emphasis> line from the file. The IP address may
112also be a router on the local network.</para>
113</sect2>
114
115</sect1>
116
Note: See TracBrowser for help on using the repository browser.