2004-05-03 11:59:46 +01:00
|
|
|
<?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;
|
|
|
|
]>
|
2004-01-27 22:29:49 +00:00
|
|
|
<sect1 id="ch-scripts-network">
|
2002-01-15 21:51:38 +00:00
|
|
|
<title>Configuring the network script</title>
|
2004-05-03 11:59:46 +01:00
|
|
|
<?dbhtml filename="network.html"?>
|
|
|
|
|
|
|
|
<indexterm zone="ch-scripts-network">
|
|
|
|
<primary sortas="d-network">network</primary>
|
|
|
|
<secondary>configuring</secondary></indexterm>
|
2002-01-15 21:51:38 +00:00
|
|
|
|
|
|
|
<para>This section only applies if you're going to configure a network
|
|
|
|
card.</para>
|
|
|
|
|
2002-04-05 04:22:04 +01:00
|
|
|
<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
|
2004-06-19 17:54:58 +01:00
|
|
|
case, you must remove the <filename class="symlink">network</filename> symlinks from all the
|
2004-05-03 11:59:46 +01:00
|
|
|
run-level directories
|
2002-04-05 04:22:04 +01:00
|
|
|
(<filename class="directory">/etc/rc.d/rc*.d</filename>)</para>
|
|
|
|
|
2002-01-15 21:51:38 +00:00
|
|
|
<sect2>
|
|
|
|
<title>Creating network interface configuration files</title>
|
|
|
|
|
|
|
|
<para>Which interfaces are brought up and down by the network script depends on
|
2004-06-19 17:54:58 +01:00
|
|
|
the files in the <filename class="directory">/etc/sysconfig/network-devices</filename> directory. This
|
|
|
|
directory should contain files in the form of <filename>ifconfig.xyz</filename>, where <quote>xyz</quote> is a
|
2002-01-15 21:51:38 +00:00
|
|
|
network interface name (such as eth0 or eth0:1)</para>
|
|
|
|
|
2004-06-19 17:54:58 +01:00
|
|
|
<para>If you decide to rename or move this <filename class="directory">/etc/sysconfig/network-devices</filename>
|
|
|
|
directory, make sure you update the <filename>/etc/sysconfig/rc</filename> file as well and
|
|
|
|
update the <quote>network_devices</quote> by providing it with the new path.</para>
|
2002-01-15 22:02:24 +00:00
|
|
|
|
2004-05-03 11:59:46 +01:00
|
|
|
<para>Now, new files are created in that directory.
|
2004-06-19 17:54:58 +01:00
|
|
|
The following command creates a sample <filename>ifconfig.eth0</filename> file:</para>
|
2002-01-15 21:51:38 +00:00
|
|
|
|
2004-06-19 17:54:58 +01:00
|
|
|
<screen><userinput>cat > /etc/sysconfig/network-devices/ifconfig.eth0 << "EOF"
|
2002-01-15 21:51:38 +00:00
|
|
|
ONBOOT=yes
|
2004-05-03 11:59:46 +01:00
|
|
|
SERVICE=static
|
2002-01-15 21:51:38 +00:00
|
|
|
IP=192.168.1.1
|
2004-05-06 21:18:25 +01:00
|
|
|
GATEWAY=192.168.1.2
|
2002-01-15 21:51:38 +00:00
|
|
|
NETMASK=255.255.255.0
|
|
|
|
BROADCAST=192.168.1.255
|
2004-06-19 17:54:58 +01:00
|
|
|
EOF</userinput></screen>
|
2002-01-15 21:51:38 +00:00
|
|
|
|
|
|
|
<para>Of course, the values of those variables have to be changed
|
2002-01-16 00:04:57 +00:00
|
|
|
in every file to match the proper setup. If the ONBOOT variable is set
|
2004-06-19 17:54:58 +01:00
|
|
|
to <quote>yes</quote>, the network script will bring up the equivalent NIC (Network Interface Card)
|
2004-05-03 11:59:46 +01:00
|
|
|
during the booting of the system.
|
2004-06-19 17:54:58 +01:00
|
|
|
If set to anything but <quote>yes</quote>, the equivalent NIC will be ignored by the network script
|
2004-05-03 11:59:46 +01:00
|
|
|
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
|
2004-06-19 17:54:58 +01:00
|
|
|
additional files in <filename class="directory">/etc/sysconfig/network-devices/services</filename>, you can allow
|
2004-05-03 11:59:46 +01:00
|
|
|
other IP assignment methods. This would commonly be used if you need DHCP,
|
|
|
|
which is addressed in the BLFS book.</para>
|
2002-01-15 21:51:38 +00:00
|
|
|
|
2004-05-06 21:18:25 +01:00
|
|
|
<para>Of course, GATEWAY should contain the IP of your default gateway, if you
|
2004-05-07 00:14:53 +01:00
|
|
|
have one. If not, then comment out the variable entirely.</para>
|
2004-05-06 21:18:25 +01:00
|
|
|
|
2002-01-15 21:51:38 +00:00
|
|
|
</sect2>
|
|
|
|
|
2004-06-19 17:54:58 +01:00
|
|
|
<sect2 id="resolv.conf">
|
2004-01-10 01:10:21 +00:00
|
|
|
<title>Creating the /etc/resolv.conf file</title>
|
2004-06-19 17:54:58 +01:00
|
|
|
<indexterm zone="resolv.conf"><primary sortas="e-/etc/resolv.conf">/etc/resolv.conf</primary></indexterm>
|
2004-01-10 01:10:21 +00:00
|
|
|
|
2004-05-03 11:59:46 +01:00
|
|
|
<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,
|
2004-01-10 01:10:21 +00:00
|
|
|
into <filename>/etc/resolv.conf</filename>. Create the file by running the
|
|
|
|
following:</para>
|
|
|
|
|
2004-06-19 17:54:58 +01:00
|
|
|
<screen><userinput>cat > /etc/resolv.conf << "EOF"
|
2004-01-10 01:10:21 +00:00
|
|
|
# Begin /etc/resolv.conf
|
|
|
|
|
2004-06-19 17:54:58 +01:00
|
|
|
nameserver <replaceable>[IP address of your nameserver]</replaceable>
|
2004-01-10 01:10:21 +00:00
|
|
|
|
|
|
|
# End /etc/resolv.conf
|
2004-06-19 17:54:58 +01:00
|
|
|
EOF</userinput></screen>
|
2004-01-10 01:10:21 +00:00
|
|
|
|
2004-06-19 17:54:58 +01:00
|
|
|
<para>Of course, replace <replaceable>[IP address of your nameserver]</replaceable> with the IP
|
2004-05-03 11:59:46 +01:00
|
|
|
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>
|
2004-01-10 01:10:21 +00:00
|
|
|
|
|
|
|
</sect2>
|
|
|
|
|
2002-01-15 21:51:38 +00:00
|
|
|
</sect1>
|