[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">
|
---|
[00a2bd12] | 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 |
|
---|
| 14 | <para>This section only applies if you're going to configure a network
|
---|
| 15 | card.</para>
|
---|
| 16 |
|
---|
[6547aa1] | 17 | <para>If you don't have any network cards, you are most likely not going to
|
---|
| 18 | create any configuration files relating to network cards. If that is the
|
---|
| 19 | case, you must remove the <filename>network</filename> symlinks from all the
|
---|
[673b0d8] | 20 | run-level directories
|
---|
[6547aa1] | 21 | (<filename class="directory">/etc/rc.d/rc*.d</filename>)</para>
|
---|
| 22 |
|
---|
[00a2bd12] | 23 | <sect2>
|
---|
| 24 | <title>Configuring default gateway</title>
|
---|
| 25 |
|
---|
[673b0d8] | 26 | <para>If you're on a network you may need to set up the default gateway (a node on your network that provides access to other networks) for
|
---|
[00a2bd12] | 27 | this machine. This is done by adding the proper values to the
|
---|
| 28 | /etc/sysconfig/network file by running the following:</para>
|
---|
| 29 |
|
---|
[21ba4e3] | 30 | <screen><userinput>cat >> /etc/sysconfig/network << "EOF"</userinput>
|
---|
[00a2bd12] | 31 | GATEWAY=192.168.1.2
|
---|
| 32 | GATEWAY_IF=eth0
|
---|
[21ba4e3] | 33 | <userinput>EOF</userinput></screen>
|
---|
[00a2bd12] | 34 |
|
---|
| 35 | <para>The values for GATEWAY and GATEWAY_IF need to be changed to match
|
---|
| 36 | your network setup. GATEWAY contains the IP address of the default
|
---|
| 37 | gateway, and GATEWAY_IF contains the network interface through which the
|
---|
| 38 | default gateway can be reached.</para>
|
---|
| 39 |
|
---|
| 40 | </sect2>
|
---|
| 41 |
|
---|
| 42 | <sect2>
|
---|
| 43 | <title>Creating network interface configuration files</title>
|
---|
| 44 |
|
---|
| 45 | <para>Which interfaces are brought up and down by the network script depends on
|
---|
| 46 | the files in the /etc/sysconfig/network-devices directory. This
|
---|
| 47 | directory should contain files in the form of ifconfig.xyz, where xyz is a
|
---|
| 48 | network interface name (such as eth0 or eth0:1)</para>
|
---|
| 49 |
|
---|
[611df29] | 50 | <para>If you decide to rename or move this /etc/sysconfig/network-devices
|
---|
| 51 | directory, make sure you update the /etc/sysconfig/rc file as well and
|
---|
| 52 | update the network_devices by providing it with the new path.</para>
|
---|
[e92f48b] | 53 |
|
---|
[673b0d8] | 54 | <para>Now, new files are created in that directory.
|
---|
[00a2bd12] | 55 | The following command creates a sample ifconfig.eth0 file:</para>
|
---|
| 56 |
|
---|
[21ba4e3] | 57 | <screen><userinput>cat > /etc/sysconfig/network-devices/ifconfig.eth0 << "EOF"</userinput>
|
---|
[00a2bd12] | 58 | ONBOOT=yes
|
---|
[673b0d8] | 59 | SERVICE=static
|
---|
[00a2bd12] | 60 | IP=192.168.1.1
|
---|
| 61 | NETMASK=255.255.255.0
|
---|
| 62 | BROADCAST=192.168.1.255
|
---|
[21ba4e3] | 63 | <userinput>EOF</userinput></screen>
|
---|
[00a2bd12] | 64 |
|
---|
| 65 | <para>Of course, the values of those variables have to be changed
|
---|
[3c8d339] | 66 | in every file to match the proper setup. If the ONBOOT variable is set
|
---|
[673b0d8] | 67 | to yes, the network script will bring up the equivalent NIC (Network Interface Card)
|
---|
| 68 | during the booting of the system.
|
---|
| 69 | If set to anything but yes, the equivalent NIC will be ignored by the network script
|
---|
| 70 | and not brought up.</para>
|
---|
| 71 |
|
---|
| 72 | <para>The SERVICE entry defines the method of obtaining the IP address.
|
---|
| 73 | The LFS bootscripts have a modular IP assignment format, and by creating
|
---|
| 74 | additional files in /etc/sysconfig/network-devices/services, you can allow
|
---|
| 75 | other IP assignment methods. This would commonly be used if you need DHCP,
|
---|
| 76 | which is addressed in the BLFS book.</para>
|
---|
[00a2bd12] | 77 |
|
---|
| 78 | </sect2>
|
---|
| 79 |
|
---|
[45340ae] | 80 | <sect2>
|
---|
| 81 | <title>Creating the /etc/resolv.conf file</title>
|
---|
| 82 |
|
---|
[673b0d8] | 83 | <para>If you're going to be connected to the Internet then most likely you'll
|
---|
| 84 | need some means of DNS name resolution to resolve Internet domain names to IP
|
---|
| 85 | addresses. This is best achieved by placing the IP address of your DNS, available from your ISP (Internet Service Provider) or network administrator,
|
---|
[45340ae] | 86 | into <filename>/etc/resolv.conf</filename>. Create the file by running the
|
---|
| 87 | following:</para>
|
---|
| 88 |
|
---|
| 89 | <screen><userinput>cat > /etc/resolv.conf << "EOF"</userinput>
|
---|
| 90 | # Begin /etc/resolv.conf
|
---|
| 91 |
|
---|
| 92 | nameserver <IP address of your nameserver>
|
---|
| 93 |
|
---|
| 94 | # End /etc/resolv.conf
|
---|
| 95 | <userinput>EOF</userinput></screen>
|
---|
| 96 |
|
---|
| 97 | <para>Of course, replace <IP address of your nameserver> with the IP
|
---|
[673b0d8] | 98 | address of the DNS most appropriate for your setup. There will often be
|
---|
| 99 | more than one entry (requirements demand secondary servers for fallback capability). The IP address may even be a router on your local network.</para>
|
---|
[45340ae] | 100 |
|
---|
| 101 | </sect2>
|
---|
| 102 |
|
---|
[00a2bd12] | 103 | </sect1>
|
---|