source: chapter07/network.xml@ 4aa0d18

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 6.3 6.4 6.5 6.6 6.7 6.8 7.0 7.1 7.2 7.3 7.4 7.5 7.5-systemd 7.6 7.6-systemd 7.7 7.7-systemd 7.8 7.8-systemd 7.9 7.9-systemd 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since 4aa0d18 was 4aa0d18, checked in by Archaic <archaic@…>, 19 years ago

Reworded network.xml.

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

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