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