source: BOOK/bootscripts/common/network.xml@ 5aa9a7f

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 5aa9a7f was 3f8be484, checked in by Jim Gifford <clfs@…>, 19 years ago

r627@server (orig r625): jim | 2005-10-31 12:59:34 -0800
Import of Cross-LFS Book

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