[673b0d8] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[1770019] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
---|
[673b0d8] | 3 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
| 4 | %general-entities;
|
---|
| 5 | ]>
|
---|
[3be4d97] | 6 | <sect1 id="ch-scripts-network">
|
---|
[bce08ef] | 7 | <title>Configuring the network Script</title>
|
---|
[673b0d8] | 8 | <?dbhtml filename="network.html"?>
|
---|
| 9 |
|
---|
[81fd230] | 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>
|
---|
[00a2bd12] | 22 |
|
---|
| 23 | <sect2>
|
---|
[bce08ef] | 24 | <title>Creating Network Interface Configuration Files</title>
|
---|
[00a2bd12] | 25 |
|
---|
[81fd230] | 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.
|
---|
[07da7ec] | 30 | This directory should contain a sub-directory for each interface to be configured,
|
---|
[81fd230] | 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 |
|
---|
[07da7ec] | 36 | <para>The following command creates a sample <filename>ipv4</filename> file for
|
---|
| 37 | the <emphasis>eth0</emphasis> device:</para>
|
---|
[00a2bd12] | 38 |
|
---|
[a088964] | 39 | <screen><userinput>cd /etc/sysconfig/network-devices &&
|
---|
| 40 | mkdir ifconfig.eth0 &&
|
---|
| 41 | cat > ifconfig.eth0/ipv4 << "EOF"
|
---|
[d72e04a] | 42 | <literal>ONBOOT=yes
|
---|
[a088964] | 43 | SERVICE=ipv4-static
|
---|
[00a2bd12] | 44 | IP=192.168.1.1
|
---|
[ba85054d] | 45 | GATEWAY=192.168.1.2
|
---|
[c0155c7] | 46 | PREFIX=24
|
---|
[d72e04a] | 47 | BROADCAST=192.168.1.255</literal>
|
---|
[f67f5cf] | 48 | EOF</userinput></screen>
|
---|
[00a2bd12] | 49 |
|
---|
[b568bbaf] | 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>
|
---|
[81fd230] | 55 |
|
---|
[b8a3fb2] | 56 | <para>The <envar>SERVICE</envar> variable defines the method used for obtaining
|
---|
[b568bbaf] | 57 | the IP address. The LFS-Bootscripts package has a modular IP assignment format,
|
---|
| 58 | and creating additional files in the <filename
|
---|
[aabd480] | 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>
|
---|
[81fd230] | 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 |
|
---|
[b568bbaf] | 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>
|
---|
[81fd230] | 75 |
|
---|
[19d6aec] | 76 | <beginpage/>
|
---|
| 77 |
|
---|
[00a2bd12] | 78 | </sect2>
|
---|
| 79 |
|
---|
[f67f5cf] | 80 | <sect2 id="resolv.conf">
|
---|
[d72e04a] | 81 | <title>Creating the /etc/resolv.conf File</title>
|
---|
[81fd230] | 82 | <indexterm zone="resolv.conf"><primary sortas="e-/etc/resolv.conf">/etc/resolv.conf</primary></indexterm>
|
---|
[45340ae] | 83 |
|
---|
[81fd230] | 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>
|
---|
[45340ae] | 91 |
|
---|
[f67f5cf] | 92 | <screen><userinput>cat > /etc/resolv.conf << "EOF"
|
---|
[d72e04a] | 93 | <literal># Begin /etc/resolv.conf
|
---|
[45340ae] | 94 |
|
---|
[a088964] | 95 | domain {<replaceable>[Your Domain Name]</replaceable>}
|
---|
[d72e04a] | 96 | nameserver <replaceable>[IP address of your primary nameserver]</replaceable>
|
---|
| 97 | nameserver <replaceable>[IP address of your secondary nameserver]</replaceable>
|
---|
[45340ae] | 98 |
|
---|
[d72e04a] | 99 | # End /etc/resolv.conf</literal>
|
---|
[f67f5cf] | 100 | EOF</userinput></screen>
|
---|
[45340ae] | 101 |
|
---|
[81fd230] | 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>
|
---|
[45340ae] | 109 | </sect2>
|
---|
| 110 |
|
---|
[00a2bd12] | 111 | </sect1>
|
---|
[81fd230] | 112 |
|
---|