204 lines
9.3 KiB
HTML
204 lines
9.3 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
|
|
<!Converted with LaTeX2HTML 95.1 (Fri Jan 20 1995) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds >
|
|
<HEAD>
|
|
<TITLE>5.3.2.2 The networking rc files</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
<meta name="description" value="5.3.2.2 The networking rc files">
|
|
<meta name="keywords" value="gs">
|
|
<meta name="resource-type" value="document">
|
|
<meta name="distribution" value="global">
|
|
<P>
|
|
<BR> <HR><A NAME=tex2html4473 HREF="node211.html"><IMG ALIGN=BOTTOM ALT="next" SRC="next_motif.gif"></A> <A NAME=tex2html4471 HREF="node208.html"><IMG ALIGN=BOTTOM ALT="up" SRC="up_motif.gif"></A> <A NAME=tex2html4465 HREF="node209.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif"></A> <A NAME=tex2html4475 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif"></A> <A NAME=tex2html4476 HREF="node250.html"><IMG ALIGN=BOTTOM ALT="index" SRC="index_motif.gif"></A> <BR>
|
|
<B> Next:</B> <A NAME=tex2html4474 HREF="node211.html">5.3.2.3 /etc/hosts</A>
|
|
<B>Up:</B> <A NAME=tex2html4472 HREF="node208.html">5.3.2 Configuring TCP/IP on </A>
|
|
<B> Previous:</B> <A NAME=tex2html4466 HREF="node209.html">5.3.2.1 Your network configuration</A>
|
|
<BR> <HR> <P>
|
|
<H3><A NAME=SECTION00732200000000000000>5.3.2.2 The networking rc files</A></H3>
|
|
<P>
|
|
<A NAME=5757> </A>
|
|
<A NAME=5758> </A>
|
|
<A NAME=6059> </A>
|
|
<tt>rc</tt> files are systemwide configuration scripts executed at boot
|
|
time by <tt>init</tt>, which start up all of the basic system daemons
|
|
(such as <tt>sendmail</tt>, <tt>cron</tt>, etc.) and configure things
|
|
such as the network parameters, system hostname, and so on.
|
|
<tt>rc</tt> files are usually found in the directory <tt>/etc/rc.d</tt> but
|
|
on other systems may be in <tt>/etc</tt>.
|
|
<P>
|
|
<A NAME=6060> </A>
|
|
<A NAME=6061> </A>
|
|
<A NAME=6062> </A>
|
|
<A NAME=6063> </A>
|
|
<A NAME=6064> </A>
|
|
Here, we're going to describe the <tt>rc</tt> files used to configure
|
|
TCP/IP. There are two of them: <tt>rc.inet1</tt> and <tt>rc.inet2</tt>.
|
|
<tt>rc.inet1</tt> is used to configure the basic network parameters
|
|
(such as IP addresses and routing information) and <tt>rc.inet2</tt>
|
|
fires up the TCP/IP daemons (<tt>telnetd</tt>, <tt>ftpd</tt>, and so forth).
|
|
<P>
|
|
<A NAME=6065> </A>
|
|
<A NAME=6066> </A>
|
|
<A NAME=6067> </A>
|
|
<A NAME=6068> </A>
|
|
Many systems combine these two files into one, usually called <tt>rc.inet</tt>
|
|
or <tt>rc.net</tt>. The names given to your <tt>rc</tt> files doesn't matter,
|
|
as long as they perform the correct functions and are executed at boot time by
|
|
<tt>init</tt>. To ensure this, you may need to edit <tt>/etc/inittab</tt>
|
|
and uncomment lines to execute the appropriate <tt>rc</tt> file(s). In the
|
|
worst case you will have to create the <tt>rc.inet1</tt> and <tt>rc.inet2</tt>
|
|
files from scratch and add entries for them to <tt>/etc/inittab</tt>.
|
|
<P>
|
|
As we said, <tt>rc.inet1</tt> configures the basic network interface.
|
|
This includes your IP and network address, and the routing table information
|
|
for your network. The routing tables are used to route outgoing (and
|
|
incoming) network datagrams to other machines. On most simple configurations,
|
|
you have three routes: One for sending packets to your own machine,
|
|
another for sending packets to other machines on your network, and
|
|
another for sending packets to machines outside of your network (through
|
|
the gateway machine). Two programs are used to configure these parameters:
|
|
<tt>ifconfig</tt> and <tt>route</tt>. Both of these are usually found in <tt>/etc</tt>.
|
|
<P>
|
|
<A NAME=6069> </A>
|
|
<A NAME=6070> </A>
|
|
<A NAME=6071> </A>
|
|
<A NAME=6072> </A>
|
|
<tt>ifconfig</tt> is used for configuring the network device interface with
|
|
the parameters that it requires to function, such as the IP address, network
|
|
mask, broadcast address and the like.
|
|
<tt>route</tt> is used to create and modify entries in the routing table.
|
|
<P>
|
|
<A NAME=6073> </A>
|
|
<A NAME=6074> </A>
|
|
For most configurations, an <tt>rc.inet1</tt> file that looks like the following
|
|
should work. You will, of course, have to edit this for your own system.
|
|
Do <em>not</em> use the sample IP and network addresses listed here for
|
|
your own system; they correspond to an actual machine on the Internet.
|
|
<P>
|
|
<P><TT> <PRE>#!/bin/sh
|
|
# This is /etc/rc.d/rc.inet1 -- Configure the TCP/IP interfaces
|
|
|
|
# First, configure the loopback device
|
|
|
|
HOSTNAME=`hostname`
|
|
|
|
/etc/ifconfig lo 127.0.0.1 # uses default netmask 255.0.0.0
|
|
/etc/route add 127.0.0.1 # a route to point to the loopback device
|
|
|
|
# Next, configure the ethernet device. If you're only using loopback or
|
|
# SLIP, comment out the rest of these lines.
|
|
|
|
# Edit for your setup.
|
|
IPADDR="128.253.154.32" # REPLACE with YOUR IP address
|
|
NETMASK="255.255.255.0" # REPLACE with YOUR netmask
|
|
NETWORK="128.253.154.0" # REPLACE with YOUR network address
|
|
BROADCAST="128.253.154.255" # REPLACE with YOUR broadcast address, if you
|
|
# have one. If not, leave blank and edit below.
|
|
GATEWAY="128.253.154.1" # REPLACE with YOUR gateway address!
|
|
|
|
/etc/ifconfig eth0 ${IPADDR} netmask ${NETMASK} broadcast ${BROADCAST}
|
|
|
|
# If you don't have a broadcast address, change the above line to just:
|
|
# /etc/ifconfig eth0 ${IPADDR} netmask ${NETMASK}
|
|
|
|
/etc/route add ${NETWORK}
|
|
|
|
# The following is only necessary if you have a gateway; that is, your
|
|
# network is connected to the outside world.
|
|
/etc/route add default gw ${GATEWAY} metric 1
|
|
|
|
# End of Ethernet Configuration
|
|
</PRE> <P></TT>
|
|
<P>
|
|
Again, you may have to tweak this file somewhat to get it
|
|
to work. The above should be sufficient for the majority of simple
|
|
network configurations, but certainly not all.
|
|
<P>
|
|
<A NAME=6075> </A>
|
|
<A NAME=6076> </A>
|
|
<A NAME=6077> </A>
|
|
<tt>rc.inet2</tt> starts up various servers used by the TCP/IP suite.
|
|
The most important of these is <tt>inetd</tt>. <tt>inetd</tt> sits in the
|
|
background and listens to various network ports. When a machine
|
|
tries to make a connection to a certain port (for example, the
|
|
incoming <tt>telnet</tt> port), <tt>inetd</tt> forks off a copy of the
|
|
appropriate daemon for that port (in the case of the <tt>telnet</tt>
|
|
port, <tt>inetd</tt> starts <tt>in.telnetd</tt>). This is simpler than
|
|
running many separate, standalone daemons (e.g., individual copies
|
|
of <tt>telnetd</tt>, <tt>ftpd</tt>, and so forth)---<tt>inetd</tt> starts up
|
|
the daemons only when they are needed.
|
|
<P>
|
|
<A NAME=6078> </A>
|
|
<A NAME=6079> </A>
|
|
<A NAME=6080> </A>
|
|
<A NAME=6081> </A>
|
|
<tt>syslogd</tt> is the system logging daemon---it accumulates log messages
|
|
from various applications and stores them into log files based on
|
|
the configuration information in <tt>/etc/syslogd.conf</tt>.
|
|
<tt>routed</tt> is a server used to maintain dynamic routing information.
|
|
When your system attempts to send packets to another network, it may
|
|
require additional routing table entries in order to do so.
|
|
<tt>routed</tt> takes care of manipulating the routing table without
|
|
the need for user intervention.
|
|
<P>
|
|
<A NAME=5830> </A>
|
|
<A NAME=5831> </A>
|
|
Our example <tt>rc.inet2</tt>, below, only starts up the bare minimum
|
|
of servers. There are many other servers as well---many of which have
|
|
to do with NFS configuration. When attempting to setup TCP/IP on your
|
|
system, it's usually best to start with a minimal configuration and
|
|
add more complex pieces (such as NFS) when you have things working.
|
|
<P>
|
|
Note that in the below file, we assume that all of the network daemons
|
|
are held in <tt>/etc</tt>. As usual, edit this for your own configuration.
|
|
<P>
|
|
<A NAME=6082> </A>
|
|
<A NAME=6083> </A>
|
|
<P><TT> <PRE>#! /bin/sh
|
|
# Sample /etc/rc.d/rc.inet2
|
|
|
|
# Start syslogd
|
|
if [ -f /etc/syslogd ]
|
|
then
|
|
/etc/syslogd
|
|
fi
|
|
|
|
# Start inetd
|
|
if [ -f /etc/inetd ]
|
|
then
|
|
/etc/inetd
|
|
fi
|
|
|
|
# Start routed
|
|
if [ -f /etc/routed ]
|
|
then
|
|
/etc/routed -q
|
|
fi
|
|
|
|
# Done!
|
|
</PRE> <P></TT>
|
|
<P>
|
|
<A NAME=6084> </A>
|
|
<A NAME=6085> </A>
|
|
Among the various additional servers that you may want to start in
|
|
<tt>rc.inet2</tt> is <tt>named</tt>. <tt>named</tt> is a name server---it
|
|
is responsible for translating (local) IP addresses to names, and vice
|
|
versa. If you don't have a nameserver elsewhere on the network, or
|
|
want to provide local machine names to other machines in your domain,
|
|
it may be necessary to run <tt>named</tt>. (For most configurations it
|
|
is not necessary, however.) <tt>named</tt> configuration is somewhat
|
|
complex and requires planning; we refer interested readers to a good
|
|
book on TCP/IP network administration.
|
|
<P>
|
|
<BR> <HR><A NAME=tex2html4473 HREF="node211.html"><IMG ALIGN=BOTTOM ALT="next" SRC="next_motif.gif"></A> <A NAME=tex2html4471 HREF="node208.html"><IMG ALIGN=BOTTOM ALT="up" SRC="up_motif.gif"></A> <A NAME=tex2html4465 HREF="node209.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif"></A> <A NAME=tex2html4475 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif"></A> <A NAME=tex2html4476 HREF="node250.html"><IMG ALIGN=BOTTOM ALT="index" SRC="index_motif.gif"></A> <BR>
|
|
<B> Next:</B> <A NAME=tex2html4474 HREF="node211.html">5.3.2.3 /etc/hosts</A>
|
|
<B>Up:</B> <A NAME=tex2html4472 HREF="node208.html">5.3.2 Configuring TCP/IP on </A>
|
|
<B> Previous:</B> <A NAME=tex2html4466 HREF="node209.html">5.3.2.1 Your network configuration</A>
|
|
<BR> <HR> <P>
|
|
<BR> <HR>
|
|
<P><ADDRESS>
|
|
<I>Matt Welsh <BR>
|
|
mdw@sunsite.unc.edu</I>
|
|
</ADDRESS>
|
|
</BODY>
|