1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-scripts-network">
<title>Configuring the network script</title>
<?dbhtml filename="network.html"?>
<indexterm zone="ch-scripts-network">
<primary sortas="d-network">network</primary>
<secondary>configuring</secondary></indexterm>
<para>This section only applies if you're going to configure a network
card.</para>
<para>If you don't have any network cards, you are most likely not going to
create any configuration files relating to network cards. If that is the
case, you must remove the <filename>network</filename> symlinks from all the
run-level directories
(<filename class="directory">/etc/rc.d/rc*.d</filename>)</para>
<sect2>
<title>Creating network interface configuration files</title>
<para>Which interfaces are brought up and down by the network script depends on
the files in the /etc/sysconfig/network-devices directory. This
directory should contain files in the form of ifconfig.xyz, where xyz is a
network interface name (such as eth0 or eth0:1)</para>
<para>If you decide to rename or move this /etc/sysconfig/network-devices
directory, make sure you update the /etc/sysconfig/rc file as well and
update the network_devices by providing it with the new path.</para>
<para>Now, new files are created in that directory.
The following command creates a sample ifconfig.eth0 file:</para>
<screen><userinput>cat > /etc/sysconfig/network-devices/ifconfig.eth0 << "EOF"</userinput>
ONBOOT=yes
SERVICE=static
IP=192.168.1.1
GATEWAY=192.168.1.2
NETMASK=255.255.255.0
BROADCAST=192.168.1.255
<userinput>EOF</userinput></screen>
<para>Of course, the values of those variables have to be changed
in every file to match the proper setup. If the ONBOOT variable is set
to yes, the network script will bring up the equivalent NIC (Network Interface Card)
during the booting of the system.
If set to anything but yes, the equivalent NIC will be ignored by the network script
and not brought up.</para>
<para>The SERVICE entry defines the method of obtaining the IP address.
The LFS bootscripts have a modular IP assignment format, and by creating
additional files in /etc/sysconfig/network-devices/services, you can allow
other IP assignment methods. This would commonly be used if you need DHCP,
which is addressed in the BLFS book.</para>
<para>Of course, GATEWAY should contain the IP of your default gateway, if you
have one. If not, them comment out the variable entirely.</para>
</sect2>
<sect2>
<title>Creating the /etc/resolv.conf file</title>
<para>If you're going to be connected to the Internet then most likely you'll
need some means of DNS name resolution to resolve Internet domain names to IP
addresses. This is best achieved by placing the IP address of your DNS, available from your ISP (Internet Service Provider) or network administrator,
into <filename>/etc/resolv.conf</filename>. Create the file by running the
following:</para>
<screen><userinput>cat > /etc/resolv.conf << "EOF"</userinput>
# Begin /etc/resolv.conf
nameserver <IP address of your nameserver>
# End /etc/resolv.conf
<userinput>EOF</userinput></screen>
<para>Of course, replace <IP address of your nameserver> with the IP
address of the DNS most appropriate for your setup. There will often be
more than one entry (requirements demand secondary servers for fallback capability). The IP address may even be a router on your local network.</para>
</sect2>
</sect1>
|