123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <sect1 id="ch-scripts-network">
- <title>Configuring the network script</title>
- <?dbhtml filename="network.html" dir="chapter07"?>
- <para>This section only applies if you're going to configure a network
- card.</para>
- <para>If you don't have any network cards, you are most likely not going to
- create any configuration files relating to network cards. If that is the
- case, you must remove the <filename>network</filename> symlinks from all the
- runlevel directories
- (<filename class="directory">/etc/rc.d/rc*.d</filename>)</para>
- <sect2>
- <title>Configuring default gateway</title>
- <para>If you're on a network you may need to set up the default gateway for
- this machine. This is done by adding the proper values to the
- /etc/sysconfig/network file by running the following:</para>
- <screen><userinput>cat >> /etc/sysconfig/network << "EOF"</userinput>
- GATEWAY=192.168.1.2
- GATEWAY_IF=eth0
- <userinput>EOF</userinput></screen>
- <para>The values for GATEWAY and GATEWAY_IF need to be changed to match
- your network setup. GATEWAY contains the IP address of the default
- gateway, and GATEWAY_IF contains the network interface through which the
- default gateway can be reached.</para>
- </sect2>
- <sect2>
- <title>Creating network interface configuration files</title>
- <para>Which interfaces are brought up and down by the network script depends on
- the files in the /etc/sysconfig/network-devices directory. This
- directory should contain files in the form of ifconfig.xyz, where xyz is a
- network interface name (such as eth0 or eth0:1)</para>
- <para>If you decide to rename or move this /etc/sysconfig/network-devices
- directory, make sure you update the /etc/sysconfig/rc file as well and
- update the network_devices by providing it with the new path.</para>
- <para>Now, new files are created in that directory containing the following.
- The following command creates a sample ifconfig.eth0 file:</para>
- <screen><userinput>cat > /etc/sysconfig/network-devices/ifconfig.eth0 << "EOF"</userinput>
- ONBOOT=yes
- IP=192.168.1.1
- NETMASK=255.255.255.0
- BROADCAST=192.168.1.255
- <userinput>EOF</userinput></screen>
- <para>Of course, the values of those variables have to be changed
- in every file to match the proper setup. If the ONBOOT variable is set
- to yes, the network script will bring it up during the booting of the system.
- If set to anything else but yes, it will be ignored by the network script
- and thus not brought up.</para>
- </sect2>
- <sect2>
- <title>Creating the /etc/resolv.conf file</title>
- <para>If you're going to be connected to the internet then most likely you'll
- need some means of DNS name resolution to resolve internet domain names to IP
- addresses. This is best achieved by placing the IP address of a DNS server
- into <filename>/etc/resolv.conf</filename>. Create the file by running the
- following:</para>
- <screen><userinput>cat > /etc/resolv.conf << "EOF"</userinput>
- # Begin /etc/resolv.conf
- nameserver <IP address of your nameserver>
- # End /etc/resolv.conf
- <userinput>EOF</userinput></screen>
- <para>Of course, replace <IP address of your nameserver> with the IP
- address of the DNS server most appropriate for your setup. This will often be
- provided by your ISP or it may even be a router on your local network.</para>
- </sect2>
- </sect1>
|