[3f8be484] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[aa18ac0] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
[0b9e109] | 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
[3f8be484] | 5 | %general-entities;
|
---|
| 6 | ]>
|
---|
| 7 |
|
---|
[0b9e109] | 8 | <sect1 id="ch-network-static-network">
|
---|
[3f8be484] | 9 | <?dbhtml filename="network.html"?>
|
---|
| 10 |
|
---|
| 11 | <title>Configuring the network Script</title>
|
---|
| 12 |
|
---|
[0b9e109] | 13 | <indexterm zone="ch-network-static-network">
|
---|
[3f8be484] | 14 | <primary sortas="d-network">network</primary>
|
---|
| 15 | <secondary>configuring</secondary></indexterm>
|
---|
| 16 |
|
---|
| 17 | <para>This section only applies if a network card is to be
|
---|
| 18 | configured.</para>
|
---|
| 19 |
|
---|
| 20 | <para>If a network card will not be used, there is likely no need to
|
---|
| 21 | create any configuration files relating to network cards. If that is
|
---|
| 22 | the case, remove the <filename class="symlink">network</filename>
|
---|
| 23 | symlinks from all run-level directories (<filename
|
---|
| 24 | class="directory">/etc/rc.d/rc*.d</filename>).</para>
|
---|
| 25 |
|
---|
| 26 | <sect2>
|
---|
| 27 | <title>Creating Network Interface Configuration Files</title>
|
---|
| 28 |
|
---|
| 29 | <para>Which interfaces are brought up and down by the network script
|
---|
| 30 | depends on the files and directories in the <filename
|
---|
| 31 | class="directory">/etc/sysconfig/network-devices</filename> hierarchy.
|
---|
| 32 | This directory should contain a sub-directory for each interface to be
|
---|
| 33 | configured, such as <filename>ifconfig.xyz</filename>, where
|
---|
| 34 | <quote>xyz</quote> is a network interface name. Inside this directory
|
---|
[c62aadc] | 35 | would be files defining the attributes to this interface, such as its IP
|
---|
| 36 | address(es), subnet masks, and so forth.</para>
|
---|
[3f8be484] | 37 |
|
---|
| 38 | <para>The following command creates a sample <filename>ipv4</filename>
|
---|
[c62aadc] | 39 | file for the <emphasis>eth0</emphasis> device:</para>
|
---|
[3f8be484] | 40 |
|
---|
| 41 | <screen><userinput>cd /etc/sysconfig/network-devices &&
|
---|
[661d1a4] | 42 | mkdir -v ifconfig.eth0 &&
|
---|
[3f8be484] | 43 | cat > ifconfig.eth0/ipv4 << "EOF"
|
---|
| 44 | <literal>ONBOOT=yes
|
---|
| 45 | SERVICE=ipv4-static
|
---|
| 46 | IP=192.168.1.1
|
---|
| 47 | GATEWAY=192.168.1.2
|
---|
| 48 | PREFIX=24
|
---|
| 49 | BROADCAST=192.168.1.255</literal>
|
---|
| 50 | EOF</userinput></screen>
|
---|
| 51 |
|
---|
[c62aadc] | 52 | <para>The values of these variables must be changed in every file to match
|
---|
| 53 | the proper setup. If the <envar>ONBOOT</envar> variable is set to
|
---|
| 54 | <quote>yes</quote> the network script will bring up the Network Interface
|
---|
| 55 | Card (NIC) during booting of the system. If set to anything but
|
---|
| 56 | <quote>yes</quote> the NIC will be ignored by the network script and not
|
---|
| 57 | be brought up.</para>
|
---|
[3f8be484] | 58 |
|
---|
| 59 | <para>The <envar>SERVICE</envar> variable defines the method used for
|
---|
[fb40919] | 60 | obtaining the IP address. The CLFS-Bootscripts package has a modular IP
|
---|
[3f8be484] | 61 | assignment format, and creating additional files in the <filename
|
---|
| 62 | class="directory">/etc/sysconfig/network-devices/services</filename>
|
---|
[c62aadc] | 63 | directory allows other IP assignment methods. This is commonly used for
|
---|
[e3a8717] | 64 | Dynamic Host Configuration Protocol (DHCP), which is addressed in CBLFS.</para>
|
---|
[3f8be484] | 65 |
|
---|
| 66 | <para>The <envar>GATEWAY</envar> variable should contain the default
|
---|
| 67 | gateway IP address, if one is present. If not, then comment out the
|
---|
| 68 | variable entirely.</para>
|
---|
| 69 |
|
---|
[c62aadc] | 70 | <para>The <envar>PREFIX</envar> variable needs to contain the number of
|
---|
| 71 | bits used in the subnet. Each octet in an IP address is 8 bits. If the
|
---|
| 72 | subnet's netmask is 255.255.255.0, then it is using the first three octets
|
---|
| 73 | (24 bits) to specify the network number. If the netmask is 255.255.255.240,
|
---|
| 74 | it would be using the first 28 bits. Prefixes longer than 24 bits are
|
---|
| 75 | commonly used by DSL and cable-based Internet Service Providers (ISPs).
|
---|
| 76 | In this example (PREFIX=24), the netmask is 255.255.255.0. Adjust the
|
---|
| 77 | <envar>PREFIX</envar> variable according to your specific subnet.</para>
|
---|
[3f8be484] | 78 |
|
---|
| 79 | </sect2>
|
---|
| 80 |
|
---|
| 81 | <sect2 id="resolv.conf">
|
---|
| 82 | <title>Creating the /etc/resolv.conf File</title>
|
---|
| 83 |
|
---|
| 84 | <indexterm zone="resolv.conf">
|
---|
| 85 | <primary sortas="e-/etc/resolv.conf">/etc/resolv.conf</primary>
|
---|
| 86 | </indexterm>
|
---|
| 87 |
|
---|
| 88 | <para>If the system is going to be connected to the Internet, it will
|
---|
[c62aadc] | 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
|
---|
| 93 | <filename>/etc/resolv.conf</filename>. Create the file by running the
|
---|
| 94 | following:</para>
|
---|
[3f8be484] | 95 |
|
---|
| 96 | <screen><userinput>cat > /etc/resolv.conf << "EOF"
|
---|
| 97 | <literal># Begin /etc/resolv.conf
|
---|
| 98 |
|
---|
[60915df] | 99 | domain <replaceable>[Your Domain Name]</replaceable>
|
---|
[3f8be484] | 100 | nameserver <replaceable>[IP address of your primary nameserver]</replaceable>
|
---|
| 101 | nameserver <replaceable>[IP address of your secondary nameserver]</replaceable>
|
---|
| 102 |
|
---|
| 103 | # End /etc/resolv.conf</literal>
|
---|
| 104 | EOF</userinput></screen>
|
---|
| 105 |
|
---|
| 106 | <para>Replace <replaceable>[IP address of the nameserver]</replaceable>
|
---|
| 107 | with the IP address of the DNS most appropriate for the setup. There will
|
---|
| 108 | often be more than one entry (requirements demand secondary servers for
|
---|
| 109 | fallback capability). If you only need or want one DNS server, remove the
|
---|
| 110 | second <emphasis>nameserver</emphasis> line from the file. The IP address
|
---|
| 111 | may also be a router on the local network.</para>
|
---|
| 112 |
|
---|
| 113 | </sect2>
|
---|
| 114 |
|
---|
| 115 | </sect1>
|
---|