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