Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (5.07 MB, 753 trang )
[Chapter 7] 7.2 The Minimal Routing Table
% ping -s almond
PING almond.nuts.com: 56 data bytes
64 bytes from almond.nuts.com (172.16.12.1): icmp_seq=0. time=11. ms
64 bytes from almond.nuts.com (172.16.12.1): icmp_seq=1. time=10. ms
^C
----almond.nuts.com PING Statistics---2 packets transmitted, 2 packets received, 0% packet loss
round-trip (ms) min/avg/max = 10/10/11
ping displays a line of output for each ICMP ECHO_RESPONSE received. [3] When ping is interrupted, it
displays some summary statistics. All of this indicates successful communication with almond. But if we
check a host that is not on nuts-net, say a host at O'Reilly, the results are different.
[3] Sun's ping would only display the message "almond is alive" if the -s option was not used.
Some other ping implementations do not require the -s option.
% ping 207.25.98.2
sendto: Network is unreachable
Here the message "sendto: Network is unreachable" indicates that peanut does not know how to send data to
the network that host 207.25.98.2 is on. There are only two routes in the peanut routing table and neither is a
route to 207.25.98.0.
Even other subnets on nuts-net cannot be reached using this routing table. To demonstrate this, ping a host on
another subnet. For example:
% ping 172.16.1.2
sendto: Network is unreachable
These ping tests show that the routing table created by ifconfig allows communication only with other hosts
on the local network. If your network does not require access to any other TCP/IP networks, this may be all
you need. However, if it does require access to other networks, you must add more routes to the routing table.
Previous: 7.1 Common
Routing Configurations
7.1 Common Routing
Configurations
TCP/IP Network
Administration
Book Index
Next: 7.3 Building a Static
Routing Table
7.3 Building a Static Routing
Table
[ Library Home | DNS & BIND | TCP/IP | sendmail | sendmail Reference | Firewalls | Practical Security ]
file:///C|/mynapster/Downloads/warez/tcpip/ch07_02.htm (2 of 2) [2001-10-15 09:17:45]
[Chapter 7] Configuring Routing
Previous: 6.5 Summary
Chapter 7
Next: 7.2 The Minimal
Routing Table
7. Configuring Routing
Contents:
Common Routing Configurations
The Minimal Routing Table
Building a Static Routing Table
Interior Routing Protocols
Exterior Routing Protocols
Gateway Routing Daemon
Configuring gated
Summary
Routing is the glue that binds the Internet together. Without it, TCP/IP traffic is limited to a single
physical network. Routing allows traffic from your local network to reach its destination somewhere
else in the world - perhaps after passing through many intermediate networks.
The important role of routing and the complex interconnection of Internet networks make the design
of routing protocols a major challenge to network software developers. Consequently, most
discussions of routing concern protocol design. Very little is written about the important task of
properly configuring routing protocols. However, more day-to-day problems are caused by
improperly configured routers than are caused by improperly designed routing algorithms. As system
administrators, we need to ensure that the routing on our systems is properly configured. This is the
task we tackle in this chapter.
7.1 Common Routing Configurations
First, we must make a distinction between routing and routing protocols. All systems route data, but
not all systems run routing protocols. Routing is the act of forwarding datagrams based on the
information contained in the routing table. Routing protocols are programs that exchange the
information used to build routing tables.
A network's routing configuration does not always require a routing protocol. In situations where the
routing information does not change - for example, when there is only one possible route, the system
file:///C|/mynapster/Downloads/warez/tcpip/ch07_01.htm (1 of 3) [2001-10-15 09:17:46]
[Chapter 7] Configuring Routing
administrator usually builds the routing table manually. Some networks have no access to any other
TCP/IP networks, and therefore do not require that the system administrator build the routing table at
all. The three most common routing configurations are: [1]
[1] Chapter 4, Getting Started , presents guidelines for choosing the correct routing
configuration for your network.
Minimal routing
A network completely isolated from all other TCP/IP networks requires only minimal routing.
A minimal routing table usually is built by ifconfig when the network interface is configured.
[2] If your network doesn't have direct access to other TCP/IP networks, and if you are not
using subnetting, this may be the only routing table you'll require.
[2] Linux is an exception. ifconfig does not create routing table entries on a Linux
system.
Static routing
A network with a limited number of gateways to other TCP/IP networks can be configured
with static routing. When a network has only one gateway, a static route is the best choice. A
static routing table is constructed manually by the system administrator using the route
command. Static routing tables do not adjust to network changes, so they work best where
routes do not change.
Dynamic routing
A network with more than one possible route to the same destination should use dynamic
routing. A dynamic routing table is built from the information exchanged by routing protocols.
The protocols are designed to distribute information that dynamically adjusts routes to reflect
changing network conditions. Routing protocols handle complex routing situations more
quickly and accurately than the system administrator can. Routing protocols are designed not
only to switch to a backup route when the primary route becomes inoperable; they are also
designed to decide which is the "best" route to a destination. On any network where there are
multiple paths to the same destination, a routing protocol should be used.
Routes are built automatically by ifconfig, manually by the system administrator, or dynamically by
routing protocols. But no matter how routes are entered, they all end up in the routing table.
Previous: 6.5 Summary
6.5 Summary
TCP/IP Network
Administration
Book Index
file:///C|/mynapster/Downloads/warez/tcpip/ch07_01.htm (2 of 3) [2001-10-15 09:17:46]
Next: 7.2 The Minimal
Routing Table
7.2 The Minimal Routing
Table
[Chapter 7] Configuring Routing
[ Library Home | DNS & BIND | TCP/IP | sendmail | sendmail Reference | Firewalls | Practical Security ]
file:///C|/mynapster/Downloads/warez/tcpip/ch07_01.htm (3 of 3) [2001-10-15 09:17:46]
[Chapter 6] 6.5 Summary
Previous: 6.4 Installing
SLIP
Chapter 6
Configuring the Interface
Next: 7. Configuring
Routing
6.5 Summary
TCP/IP works with a wide variety of networks. TCP/IP cannot make assumptions about the network it
runs on - the network interface and its characteristics must be identified to TCP/IP. In this chapter we
have looked at several examples of how to configure the physical network interface over which
TCP/IP runs.
ifconfig is the most commonly used interface configuration command. It assigns the interface its IP
address, sets the subnet mask, sets the broadcast address, and performs several other functions.
TCP/IP can also run over telephone lines using dial-up connections. Two protocols are available to do
this: Serial Line IP (SLIP) and Point-to-Point Protocol (PPP). PPP is the preferred choice. It is an
Internet standard and offers better reliability, performance, and security.
There are several steps to setting up a PPP or a SLIP connection: selecting and configuring the serial
protocol, configuring the port and modem, making the dial-up connection, and completing the remote
login. Some programs, such as dip, combine all of these steps into one program. Other programs, such
as pppd and chat, separate the functions.
Configuring the network interface allows us to talk to the local network, while configuring routing
allows us to talk to the world. We touched on routing in Chapter 2 and again in this chapter in our
discussion of routing metrics for ifconfig and default routes for PPP and SLIP. In the next chapter we
look at routing in much greater detail.
Previous: 6.4 Installing
SLIP
6.4 Installing SLIP
TCP/IP Network
Administration
Book Index
Next: 7. Configuring
Routing
7. Configuring Routing
[ Library Home | DNS & BIND | TCP/IP | sendmail | sendmail Reference | Firewalls | Practical Security ]
file:///C|/mynapster/Downloads/warez/tcpip/ch06_05.htm [2001-10-15 09:17:46]
[Chapter 6] 6.4 Installing SLIP
Previous: 6.3 Installing PPP
Chapter 6
Configuring the Interface
Next: 6.5 Summary
6.4 Installing SLIP
Installing Serial Line IP (SLIP) is very similar to installing PPP. As with PPP, support for SLIP is usually
installed in the kernel - but that is only part of the configuration. The SLIP network interface also must be
configured.
PPP and SLIP configuration is complicated by the fact that these serial line protocols support both dedicated and
dial-up connections. For our Linux sample system, this means that two different commands are used to configure
a SLIP interface depending on whether it is a dedicated or a dial-up connection. In this section we discuss both,
beginning with the configuration command for dedicated connections.
6.4.1 slattach
The slattach command "attaches" the SLIP protocol to a specific serial interface. For example:
# slattach /dev/tty03 &
This command tells the SLIP protocol to use /dev/tty03 as its serial interface. The slattach command can
optionally set some configuration parameters for the serial interface. The syntax of slattach on a Slackware 96
Linux system is:
slattach [-h | -c | -6] ttyname [baudrate]
The three options, -h, -c, and -6, select the type of SLIP protocol used. -h selects uncompressed SLIP with full
headers. CSLIP with Van Jacobsen header compression is selected with -c. Use -6 to select six-bit SLIP. If none
of these options is selected, the slattach command defaults to CSLIP.
The baudrate argument sets the interface's transmission speed. Set the speed by entering a number that
corresponds to the bit rate that is used to transmit and receive data on this line, e.g., 56000. Both ends of the line
must set exactly the same bit rate. This may be determined by the characteristics of the leased line, or by the
hardware interfaces for a direct cable connection. Regardless, the transmission speed is a physical characteristic
limited by the equipment on the line. A default transmission speed of 9600 bits per second is used if no
baudrate value is entered on the command line.
The ttyname is the name of the serial interface attached to the leased line or direct cable connection. The serial
interfaces are identified by the system during the boot. dmesg and grep displays the interface names on a
Slackware 96 Linux system:
> dmesg | grep tty
file:///C|/mynapster/Downloads/warez/tcpip/ch06_04.htm (1 of 9) [2001-10-15 09:17:47]