[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 |
|
---|
[81fd230] | 50 | <para>The values of these variables must be changed in every file to
|
---|
| 51 | match the proper setup. If the <envar>ONBOOT</envar> variable is
|
---|
| 52 | set to <quote>yes</quote> the network script will bring up the
|
---|
| 53 | Network Interface Card (NIC) during booting of the system. If set
|
---|
| 54 | to anything but <quote>yes</quote> the NIC will be ignored by the
|
---|
| 55 | network script and not brought up.</para>
|
---|
| 56 |
|
---|
[aabd480] | 57 | <para>The <envar>SERVICE</envar> variable defines the method of obtaining the IP
|
---|
| 58 | address. The LFS-Bootscripts package has a modular IP assignment format, and
|
---|
| 59 | creating additional files in the <filename
|
---|
| 60 | class="directory">/etc/sysconfig/network-devices/services</filename> directory
|
---|
| 61 | allows other IP assignment methods. This is commonly used for Dynamic Host
|
---|
| 62 | Configuration Protocol (DHCP), which is addressed in the BLFS book.</para>
|
---|
[81fd230] | 63 |
|
---|
| 64 | <para>The <envar>GATEWAY</envar> variable should contain
|
---|
| 65 | the default gateway IP address, if one is present. If not, then comment out
|
---|
| 66 | the variable entirely.</para>
|
---|
| 67 |
|
---|
| 68 | <para>The <envar>PREFIX</envar> variable needs to contain the
|
---|
| 69 | number of bits used in the subnet. Each octet in an IP address is 8
|
---|
| 70 | bits. If the subnet's netmask is 255.255.255.0, then it is using the
|
---|
| 71 | first three octets (24 bits) to specify the network number. If the
|
---|
| 72 | netmask is 255.255.255.240, it would be using the first 28 bits.
|
---|
[25f8df5] | 73 | Prefixes longer than 24 bits are commonly used by DSL and cable-based
|
---|
[81fd230] | 74 | Internet Service Providers (ISPs). In this example (PREFIX=24), the netmask
|
---|
| 75 | is 255.255.255.0. Adjust according to the specific subnet.</para>
|
---|
| 76 |
|
---|
[19d6aec] | 77 | <beginpage/>
|
---|
| 78 |
|
---|
[00a2bd12] | 79 | </sect2>
|
---|
| 80 |
|
---|
[f67f5cf] | 81 | <sect2 id="resolv.conf">
|
---|
[d72e04a] | 82 | <title>Creating the /etc/resolv.conf File</title>
|
---|
[81fd230] | 83 | <indexterm zone="resolv.conf"><primary sortas="e-/etc/resolv.conf">/etc/resolv.conf</primary></indexterm>
|
---|
[45340ae] | 84 |
|
---|
[81fd230] | 85 | <para>If the system is going to be connected to the Internet, it will
|
---|
| 86 | need some means of Domain Name Service (DNS) name resolution to
|
---|
| 87 | resolve Internet domain names to IP addresses, and vice versa. This is
|
---|
| 88 | best achieved by placing the IP address of the DNS server, available
|
---|
| 89 | from the ISP or network administrator, into
|
---|
| 90 | <filename>/etc/resolv.conf</filename>. Create the file by running the
|
---|
| 91 | following:</para>
|
---|
[45340ae] | 92 |
|
---|
[f67f5cf] | 93 | <screen><userinput>cat > /etc/resolv.conf << "EOF"
|
---|
[d72e04a] | 94 | <literal># Begin /etc/resolv.conf
|
---|
[45340ae] | 95 |
|
---|
[a088964] | 96 | domain {<replaceable>[Your Domain Name]</replaceable>}
|
---|
[d72e04a] | 97 | nameserver <replaceable>[IP address of your primary nameserver]</replaceable>
|
---|
| 98 | nameserver <replaceable>[IP address of your secondary nameserver]</replaceable>
|
---|
[45340ae] | 99 |
|
---|
[d72e04a] | 100 | # End /etc/resolv.conf</literal>
|
---|
[f67f5cf] | 101 | EOF</userinput></screen>
|
---|
[45340ae] | 102 |
|
---|
[81fd230] | 103 | <para>Replace <replaceable>[IP address of the
|
---|
| 104 | nameserver]</replaceable> with the IP address of the DNS most
|
---|
| 105 | appropriate for the setup. There will often be more than one entry
|
---|
| 106 | (requirements demand secondary servers for fallback capability). If
|
---|
| 107 | you only need or want one DNS server, remove the second
|
---|
| 108 | <emphasis>nameserver</emphasis> line from the file. The IP address may
|
---|
| 109 | also be a router on the local network.</para>
|
---|
[45340ae] | 110 | </sect2>
|
---|
| 111 |
|
---|
[00a2bd12] | 112 | </sect1>
|
---|
[81fd230] | 113 |
|
---|