source: chapter07/network.xml@ 01fd09f

6.1 6.1.1
Last change on this file since 01fd09f was 19d6aec, checked in by Manuel Canales Esparcia <manuel@…>, 19 years ago

PDF fixes in chapter07

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

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