Table Of Content,TITLE.23706 Page i Wednesday, January 9, 2002 12:29 PM
IP Routing
,COPYRIGHT.23443 Page iv Wednesday, January 9, 2002 12:29 PM
IP Routing
by Ravi Malhotra
Copyright © 2002 O’Reilly & Associates, Inc. All rights reserved.
Printed in the United States of America.
Published by O’Reilly & Associates, Inc., 1005 Gravenstein Highway North,
Sebastopol, CA 95472.
O’Reilly & Associates books may be purchased for educational, business, or sales promotional
use. Online editions are also available for most titles (safari.oreilly.com). For more information
contact our corporate/institutional sales department: (800) 998-9938 [email protected].
Editor: Jim Sumser
Production Editor: Rachel Wheeler
Cover Designer: Ellie Volckhausen
Interior Designer: Melanie Wang
Printing History:
January 2002: First Edition.
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered
trademarks of O’Reilly & Associates, Inc. The association between the image of a zebu and the
topicofIProutingisatrademarkofO’Reilly&Associates,Inc.CiscoIOSandandallCisco-based
trademarks are registered trademarks of Cisco Systems, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are
claimedastrademarks.Wherethosedesignationsappearinthisbook,andO’Reilly&Associates,
Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps.
Whileeveryprecautionhasbeentakeninthepreparationofthisbook,thepublisherassumesno
responsibility for errors or omissions, or for damages resulting from the use of the information
contained herein.
ISBN: 0-596-00275-0
[C]
,TITLE.23706 Page iii Wednesday, January 9, 2002 12:29 PM
IP Routing
Ravi Malhotra
Beijing • Cambridge • Farnham • Köln • Paris • Sebastopol • Taipei • Tokyo
,AUTHOR.COLO.23272 Page 1 Wednesday, January 9, 2002 12:28 PM
About the Author
Ravi Malhotra ([email protected]) began working for AT&T Bell Labs in 1986,
doing R&D work. Since then he has taught data communications at universities,
managed IP networks for several large financial houses, and written several maga-
zine assignments. Mr. Malhotra possesses degrees in Electrical Engineering and
Computer Science.
Colophon
Our look is the result of reader comments, our own experimentation, and feedback
from distribution channels. Distinctive covers complement our distinctive approach
to technical topics, breathing personality and life into potentially dry subjects.
The animal on the cover of IP Routing is a zebu. Zebus are a type of Bos indicus
cattle, characterized by a large fatty hump over the top of the shoulder and neck,
loose skin under the throat, and large, drooping ears. They are an intermediate size
for beef cattle—bulls generally weigh from 1,600 to 2,200 pounds and cows from
1,000 to 1,400 pounds—but have comparatively long legs and are extremely hardy.
Zebu cattle breeds include Gyr, Guzerat, Indu-Brazil, Nelore, Red Zebu, and Gray
Zebu. They originated in India and are thought to be the world’s oldest domesti-
cated cattle. Zebus were introduced into the U.S. (where they are called Brahman
cattle) in the mid-19th century as draft animals, but they later interbred with other
cattle breeds and produced hybrids that were bigger, grew faster, and were better
suited for milk and beef production. These hybrids exhibited greater resistance to
heat,disease,andcattleticksthanordinarydomesticcattleandconsequentlytended
to fare better than the cattle the colonists had brought from Europe.
Rachel Wheeler was the production editor and copyeditor for IP Routing. Tatiana
Apandi Diaz was the proofreader. Matt Hutchinson provided quality control, and
Camilla Ammirati provided production assistance. John Bickelhaupt wrote the index.
Ellie Volckhausen designed the cover of this book, based on a series design by Edie
Freedman. The cover image is a 19th-century engraving from the Dover Pictorial
Archive. Emma Colby and Melanie Wang produced the cover layout with Quark-
XPress 4.1 using Adobe’s ITC Garamond font.
MelanieWangdesignedtheinteriorlayout,basedonaseriesdesignbyDavidFutato.
NeilWallsconvertedthefilesfromMicrosoftWordtoFrameMaker5.5.6usingtools
created by Mike Sierra. The text font is Linotype Birka; the heading font is Adobe
Myriad Condensed; and the code font is LucasFont’s TheSans Mono Condensed.
The illustrations that appear in the book were produced by Robert Romano and
JessamynReadusingMacromediaFreeHand9andAdobePhotoshop6.Thetipand
warningiconsweredrawnbyChristopherBing.ThiscolophonwaswrittenbyRachel
Wheeler.
Whenever possible, our books use a durable and flexible lay-flat binding.
,p_ip_routingTOC.fm.23063 Page vii Wednesday, January 9, 2002 12:27 PM
Table of Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
1. Starting Simple . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
What Is IP Routing? 1
Directly Connected Networks 2
Static Routing 3
Dynamic Routing 5
The Routing Table 6
Underlying Processes 9
Summing Up 9
2. Routing Information Protocol (RIP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Getting RIP Running 10
How RIP Finds Shortest Paths 13
Convergence 19
Subnet Masks 26
Route Summarization 27
Default Route 28
Fine-Tuning RIP 29
Summing Up 31
3. Interior Gateway Routing Protocol (IGRP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Getting IGRP Running 33
How IGRP Works 37
Speeding Up Convergence 55
Route Summarization 56
Default Routes 57
vii
,p_ip_routingTOC.fm.23063 Page viii Wednesday, January 9, 2002 12:27 PM
Classful Route Lookups 60
Summing Up 61
4. Enhanced Interior Gateway Routing Protocol (EIGRP) . . . . . . . . . . . . . . . . . . 63
Getting EIGRP Running 64
EIGRP Metric 67
How EIGRP Works 68
Variable Length Subnet Masks 82
Route Summarization 84
Default Routes 88
Troubleshooting EIGRP 90
Summing Up 93
5. Routing Information Protocol Version 2 (RIP-2). . . . . . . . . . . . . . . . . . . . . . . . 94
Getting RIP-2 Running 95
RIP-2 Packet Format 98
RIP-1/RIP-2 Compatibility 99
Classful Versus Classless Routing Protocols 101
Classful Versus Classless Route Lookup 103
Authentication 103
Route Summarization 105
Summing Up 106
6. Open Shortest Path First (OSPF) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Getting OSPF Running 109
OSPF Metric 113
Definitions and Concepts 114
How OSPF Works 121
Route Summarization 137
Default Routes 140
Virtual Links 141
Demand Circuits 143
Stub, Totally Stubby, and Not So Stubby Areas 144
NBMA Networks 148
OSPF Design Heuristics 150
Troubleshooting OSPF 153
Summing Up 156
viii | Table of Contents
,p_ip_routingTOC.fm.23063 Page ix Wednesday, January 9, 2002 12:27 PM
7. Border Gateway Protocol 4 (BGP-4) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Background 158
Getting BGP Running 163
How BGP Works 166
Load Balancing 191
Route-Filtering 192
Connecting to the Internet 194
Choosing an ISP 199
Troubleshooting BGP 200
Summing Up 202
8. Administrative Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
Filter Routing Information 204
Rate the Trustworthiness of a Routing Information Source 207
Redistribute Routes 207
Maximum Number of Paths 211
Summing Up 211
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
Table of Contents | ix
,DEDICATION.23573 Page v Wednesday, January 9, 2002 12:29 PM
Thisbookisdedicatedtomygrandfather,thelate
P.D.Gandhi,whotaughtmetheloveoflearning.
,ch00.21432 Page xi Wednesday, January 9, 2002 12:23 PM
Preface
Ants, single-celled creatures such as the cellular slime mold, plants and animals in
ecosystems,and(even)humanbeingscancongregateanddisplaymiraculouslycom-
plexbehaviors.*Sayacolonyofantsinatreeneedstomovetoanothertree,perhaps
insearchoffood.Someantsbuildabridgebyjoiningtheirbodiesinachainstretch-
ing from one limb in one tree to another limb in another tree. Other ants cross over
this ant structure, walking over their peers. Once all the ants have crossed over, the
ants in the bridge begin to gracefully undo the structure, crossing one by one. Each
ant only repeats simple actions, over and over again; the net result of thousands of
ants working together is the miracle of the bridge, which allows the ant colony to
migrate.
Inourownhumansocietywehopetoemulatethislevelofcooperation.Eachoneof
usisusefultoothersinsomeway:wewrite,laybricks,actinthetheater,farm,drive
buses,repairhelicopters,tendtothesick,makecoffee...Asindividuals,werepeatthe
sameactsagainandagain,whetheritbemakingcoffeecupaftercoffeecuporseeing
patient after patient. The net result of all these acts is our complex, wonderful society.
So, what does all this have to do with IP routing? Each router in a network repeats
simpleprocessesoverandoveragain,asdescribedinthespecificationoftherouting
protocolitisexecuting.Thenetresultofalltheroutersinanetworkrepeatingthese
simple processes is IP routing, or the movement of IP packets in a network.
* TheNewYorkTimeshasreportedsomeintriguingexamplesofsuchbehavior,quotingresearchworkfromthe
SantaFeInstituteinNewMexico(“MindlessCreaturesActingMindfully,”TheNewYorkTimes,March23,
1999, Science Times).
xi
This is the Title of the Book, eMatter Edition
Copyright © 2002 O’Reilly & Associates, Inc. All rights reserved.