Tải bản đầy đủ (.pdf) (437 trang)

Network routing basics understanding IP routing in cisco systems

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 (6.55 MB, 437 trang )

01_772739 ffirs.qxp

3/3/06

9:19 PM

Page iii

Network Routing Basics
Understanding IP Routing
in Cisco® Systems

James Macfarlane


01_772739 ffirs.qxp

3/3/06

9:19 PM

Page ii


01_772739 ffirs.qxp

3/3/06

9:19 PM

Page i



Network Routing Basics


01_772739 ffirs.qxp

3/3/06

9:19 PM

Page ii


01_772739 ffirs.qxp

3/3/06

9:19 PM

Page iii

Network Routing Basics
Understanding IP Routing
in Cisco® Systems

James Macfarlane


01_772739 ffirs.qxp


3/3/06

9:19 PM

Page iv

Network Routing Basics: Understanding IP Routing in Cisco® Systems
Published by
Wiley Publishing, Inc.
10475 Crosspoint Boulevard
Indianapolis, IN 46256
www.wiley.com
Copyright © 2006 by James Macfarlane
Published by Wiley Publishing, Inc., Indianapolis, Indiana
Published simultaneously in Canada
ISBN-13: 978-0-471-77273-6
ISBN-10: 0-471-77273-9
Manufactured in the United States of America
10 9 8 7 6 5 4 3 2 1
1MA/TQ/QT/QW/IN
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by
any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted
under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission
of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance
Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher
for permission should be addressed to the Legal Department, Wiley Publishing, Inc., 10475 Crosspoint Blvd.,
Indianapolis, IN 46256, (317) 572-3447, fax (317) 572-4355, or online at />permissions.
Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with respect to the accuracy or completeness of the contents of this work and specifically disclaim all
warranties, including without limitation warranties of fitness for a particular purpose. No warranty may be
created or extended by sales or promotional materials. The advice and strategies contained herein may not be

suitable for every situation. This work is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services. If professional assistance is required, the services of a
competent professional person should be sought. Neither the publisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Website is referred to in this work as a citation and/or
a potential source of further information does not mean that the author or the publisher endorses the information the organization or Website may provide or recommendations it may make. Further, readers should be
aware that Internet Websites listed in this work may have changed or disappeared between when this work
was written and when it is read.
For general information on our other products and services or to obtain technical support, please contact our
Customer Care Department within the U.S. at (800) 762-2974, outside the U.S. at (317) 572-3993 or fax (317)
572-4002.
Library of Congress Cataloging-in-Publication Data:
Macfarlane, James, 1953Network routing basics : understanding IP routing in Cisco systems / James Macfarlane.
p. cm.
"Wiley Technology Publishing."
Includes bibliographical references and index.
ISBN-13: 978-0-471-77273-6 (cloth)
ISBN-10: 0-471-77273-9 (cloth)
1. TCP/IP (Computer network protocol) 2. Routers (Computer networks) I. Title.
TK5105.585.M33 2006
004.6'2--dc22
2005035954
Trademarks: Wiley and related trade dress are registered trademarks of Wiley Publishing, Inc., in the United
States and other countries, and may not be used without written permission. Cisco is a registered trademark
of Cisco Systems, Inc. All other trademarks are the property of their respective owners. Wiley Publishing, Inc.,
is not associated with any product or vendor mentioned in this book.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not
be available in electronic books.


01_772739 ffirs.qxp

3/3/06


9:19 PM

Page v

To Julia


01_772739 ffirs.qxp

3/3/06

9:19 PM

Page vi

About the Author

James Macfarlane has worked in the personal computer and networking
industry for over 20 years. He has worked in the capacity of consultant, network engineer, instructor, courseware developer, and technical writer.
Present and past certifications include Cisco CCNA, Microsoft MSCE
and MCT, CompTIA A+ Trainer, and Novell CNE and CNI. James can be
reached through his website at www.HotTrainingMaterials.com, and at


Technical Editor
Scott Bradner is the University Technology Security Officer at Harvard University. Scott founded the Harvard Network Device Test Lab, is a frequent
speaker at technical conferences, and a weekly columnist for Network World.
Mr. Bradner has served in a number of roles in the IETF, and is currently a
trustee of the American Registry of Internet Numbers (ARIN).


vi


01_772739 ffirs.qxp

3/3/06

9:19 PM

Page vii

Credits

Acquisitions Editor
Carol Long

Project Coordinator
Ryan Steffen

Development Editor
Kenyon Brown

Graphics and Production Specialists
Denny Hager
Stephanie D. Jumper
Alicia South

Technical Editor
Scott Bradner

Production Editor
Felicia Robinson
Copy Editor
Kathryn Duggan
Editorial Manager
Mary Beth Wakefield

Quality Control Technicians
Joe Niesen
Charles Spencer
Proofreading and Indexing
Tammy Todd
Johnna Van Hoose

Production Manager
Tim Tate
Vice President and Executive Group
Publisher
Richard Swadley
Vice President and Executive
Publisher
Joseph B. Wikert

vii


01_772739 ffirs.qxp

3/3/06


9:19 PM

Page viii


02_772739 ftoc.qxp

3/3/06

9:19 PM

Page ix

Contents at a Glance

Acknowledgments

xvii

Introduction

xix

Chapter 1

Networking Overview

1

Chapter 2


Routing Basics

69

Chapter 3

Static Routing

89

Chapter 4

Dynamic Routing

103

Chapter 5

RIP

137

Chapter 6

IGRP

167

Chapter 7


EIGRP

185

Chapter 8

OSPF

221

Chapter 9

External Routing Protocols in Brief

343

Chapter 10 Redistribution and Default Routing

361

Appendix A Where Do You Go From Here?

379

Appendix B Recommended Reading

381

Appendix C RFCs Related to Routing


383

Appendix D Web References

387

Appendix E Administrative Distance Table

389

Appendix F Quick-and-Dirty Subnetting—No Calculator

391

Appendix G Subnetting Helper Sheet

393

Index

395
ix


02_772739 ftoc.qxp

3/3/06

9:19 PM


Page x


02_772739 ftoc.qxp

3/3/06

9:19 PM

Page xi

Contents

Acknowledgments

xvii

Introduction

xix

Chapter 1

Networking Overview
Overview
OSI Network Model
The Conundrum of Explaining the OSI Model
Mother of All OSI Model Explanations?
Anatomy of a Data Communication Session

The Way Things Used to Be
Explanation of OSI Layers
Another Mail Analogy
Encapsulation
TCP/IP Model

Networking Equipment
Packet Forwarding
Repeaters—Layer 1, Physical
Hubs—Layer 1, Physical
Bridges—Layer 2, Data-Link
Switches—Layer 2, Data-Link
Routers—Layer 3, Network
Layer 3 Switches
CSU/DSUs (TSU)

TCP/IP Review
IP Addressing
Ports and Sockets
Important Protocols Related to Routing

Notes

1
1
2
2
3
3
5

6
12
13
15

15
16
16
16
17
18
19
23
23

24
24
56
59

67

xi


02_772739 ftoc.qxp

xii

3/3/06


9:19 PM

Page xii

Contents
Chapter 2

Routing Basics
Overview
What Is Routing?
Routing Begins at Home—The Workstation’s Route Table
Row 1—Default Gateway
Row 2—Loopback Address
Row 3—Local Subnet Address
Row 4—IP Address of Host
Rows 5, 6, and 7—Broadcast Information

Anatomy of a Routed Packet
Track a Packet—Source and Destination on the Same Network
Track a Packet—Source and Destination on Different
Networks—One Router
Track a Packet—Source and Destination on Different
Networks—Multiple Routers

Anatomy of a Route Table
Key Concept for Understanding Route Tables
Populating Route Tables

Chapter 3


71
73
74
75
75

76
76
78
80

81
82
83

Routing Metrics
Administrative Distance
Summary
Notes

84
84
86
88

Static Routing
Overview
What Is Static Routing?
When to Use Static Routes

Configuring Static Routes on a Router

89
89
90
90
91

Example with a Small Routed Network
Static Routes on a Workstation

Chapter 4

69
69
70
71

91
98

Floating Static Routes
Propagating Static Routes
Summary
Notes

100
101
101
101


Dynamic Routing
Overview
The Need for an Automated Routing Solution
What Is a Routing Protocol?
Considerations for Designing Routing Protocols
Metrics of Routing Protocols
Categorizing Dynamic Routing Protocols

103
103
104
105
106
107
108

Interior versus Exterior Routing Protocols
Distance Vector versus Link-State
Singlepath versus Multipath
Broadcast versus Multicast

108
109
117
117


02_772739 ftoc.qxp


3/3/06

9:19 PM

Page xiii

Contents
Flat versus Hierarchical
Classful versus Classless

Chapter 5

Route Summarization

119

Network Example 1
Network Example 2
Network Example 3
Network Example 4

121
124
127
132

Summary
Notes

134

135

RIP
Overview
Advantages of Using RIP
Disadvantages of Using RIP
RIP Background

137
137
138
138
139

RIP Versions
RIPv2 Improvements

How RIP Works
Advertising Routes
Learning Routes
Information that RIP Tracks About a Route
A Look at How Route Tables Are Populated by RIP

RIP’s Achilles Heel
RIP Timers that Contribute to Slow Convergence

How RIP Defends Itself Against the Dreaded Routing Loop
Anatomy of a Routing Loop
Measures to Prevent Routing Loops


Load Balancing
Default Routing
Redistribution
Command Reference—RIP
Initial Configuration
Common RIP Commands
Show Commands for RIP
Troubleshooting Commands

Chapter 6

118
118

139
140

140
140
141
141
142

145
145

146
146
149


153
153
153
154
154
159
163
164

Notes

165

IGRP
Overview
Advantages of Using IGRP
Disadvantages to Using IGRP
IGRP Background
How IGRP Works

167
167
168
168
169
170

IGRP Timers
Split Horizon
Poison Reverse

IGRP Metrics

170
171
171
171

xiii


02_772739 ftoc.qxp

xiv

3/3/06

9:19 PM

Page xiv

Contents

Chapter 7

Autonomous Numbers
Load Balancing in IGRP
Default Routing
Redistribution
Route Summarization in IGRP
Command Reference—IGRP


173
173
174
175
175
175

Initial Configuration
Common IGRP Commands
Show Commands for IGRP
Troubleshooting Commands

176
180
182
183

Notes

183

EIGRP
Overview
Advantages of Using EIGRP
Disadvantages of Using EIGRP
EIGRP Background
EIGRP Terminology

185

185
186
187
187
187

Neighbor
Neighbor Discovery and Recovery
Packet Types
Hold-Time
Neighbor Table
Topology Table
Route Table
Reliable Transport Protocol (RTP)
Retransmission Timeout (RTO)
Smooth Round Trip Time (SRRT)
Reported Distance (RD)
Feasible Distance (FD)
Feasibility Condition (FC)
Successor
Feasible Successor (FS)
Diffusing Update ALgorithm (DUAL)
The DUAL Finite State Machine
Passive and Active Route States
Stuck in Active (SIA)

How EIGRP Works
EIGRP Architecture
Populating the Topology Table and Route Table
Stuck in Active (SIA) Routes

DUAL Prevents a Routing-Loop
Load Balancing
Default Routing
Redistribution
Route Summarization

188
188
188
188
189
189
189
189
189
189
189
189
190
190
190
190
190
191
191

191
191
198
205

206
207
208
208
208


02_772739 ftoc.qxp

3/3/06

9:19 PM

Page xv

Contents

Chapter 8

Command Reference—EIGRP

208

Initial Configuration
Common EIGRP Commands
Show Commands for EIGRP
Troubleshooting Commands

209
213

217
218

Notes

219

OSPF
Overview
Advantages of Using OSPF
Disadvantages of Using OSPF
OSPF Background
Explaining OSPF
Introduction to OSPF

221
221
222
223
223
224
224

How OSPF Works

OSPF Terminology
Important Networking Terminology
Important OSPF Terminology
Watch Out for the “Type” Trap


OSPF Operation, Part 1: The Building Blocks
OSPF and Network Types
OSPF Areas
OSPF Metrics and Population of the Route Table
Route Summarization in OSPF
Redistribution in OSPF
Default Routing in OSPF
Partitioned Areas
Virtual Links
The Options Field

OSPF Operation, Part 2: Tying It All Together
Designing OSPF Networks

Command Reference
Single Area Model
Multi-area Model—Standard Area
Other Common OSPF Commands

Chapter 9

225

233
233
234
243

245
245

251
284
291
294
295
298
300
300

301
301

309
309
314
331

Notes

340

External Routing Protocols in Brief
Overview
Internal versus External Routing Protocols
A Brief History of External Gateway Protocols
BGP—King of External Routing Protocols

343
343
344

345
346

BGP Background
When to Use BGP
Other Uses for BGP
How BGP Works

346
347
348
349

xv


02_772739 ftoc.qxp

xvi

3/3/06

9:19 PM

Page xvi

Contents
Sample BGP System
The Future of BGP


Notes
Chapter 10 Redistribution and Default Routing
Overview
Route Redistribution
The Need for Redistribution
Redistribution Issues

Default Routing
When to Use Default Routing
When Not to Use Default Routing
Configuring Default Routing

Notes

357
358

359
361
361
362
363
365

367
367
369
370

378


Appendix A Where Do You Go From Here?

379

Appendix B Recommended Reading

381

Appendix C RFCs Related to Routing

383

Appendix D Web References

387

Appendix E Administrative Distance Table

389

Appendix F Quick-and-Dirty Subnetting—No Calculator

391

Appendix G Subnetting Helper Sheet

393

Index


395


03_772739 flast.qxp

3/3/06

9:20 PM

Page xvii

Acknowledgments

Thanks to each person at Wiley, both the people I worked with personally, and
the many people I did not have the pleasure of meeting, for the care and effort
taken to publish this book.

xvii


03_772739 flast.qxp

3/3/06

9:20 PM

Page xviii



03_772739 flast.qxp

3/3/06

9:20 PM

Page xix

Introduction

A few years ago, I was preparing to teach my first introductory course on network routing. While seeking courseware material for the class, I examined a
number of books on the subject but never found one I felt completely comfortable with. In the end, I chose some standardized courseware, and ended up
handing out a series of “white papers” I had authored, in order to augment the
books used in the course. Those white papers ultimately evolved into this book.
Routing is not rocket science, but it’s a bit of a challenge to explain it in a
manner that students don’t find confusing. The basic idea of forwarding packets from one network to another is really not all that difficult a concept, but
in the maturing, Internet-driven, multi-vendor, multi-protocol, classlessly
addressed world of routing we live in today, there are a number of twists and
turns when it comes to getting all those millions of packets to their destination.
In considering an addition to the various routing primers available to the
reader, I saw a need for an up-to-date introduction to the subject that leaves the
reader—after making the investment in studying the material—with the reward
of having the confidence that they actually understand modern routing enough
to go out there and put their knowledge to work. When poorly explained, routing can be a weighty, cumbersome topic. When properly understood, routing is,
well . . . fun. It’s a really enjoyable field to work in when you have a handle on
how this aspect of networking works. There is an art to routing as well as a science. In other words, there’s more than one way to get a packet from point A to
point B. As a network engineer with a specialty in routing, you can excel in your
field and gain peer recognition by playing a game called “let’s figure out the most
efficient way to route packets on this network.” We’re here to help you play the game
well.

A primary goal in the creation of this book is to provide clear and complete
information about how modern routing works. A strong emphasis has been
xix


03_772739 flast.qxp

xx

3/3/06

9:20 PM

Page xx

Introduction

placed on giving the student a broad enough background in each covered
topic so that he or she hits critical mass if you will, whereby you haven’t just
memorized an explanation for how an aspect of routing works, you truly
understand why it works the way it does. If, while reading this book, you find
yourself saying something like “Hey, I got it!” then I have done my job.

What Material Is Covered in This Book?
Because routing is an extension of basic networking, the book starts with a
review of core networking in Chapter 1. The fundamentals of networking as it
relates to routing is presented, including a thorough review of network models,
followed with a review of networking equipment. The concept of packet forwarding is explained, and a moderate treatment of the TCP/IP protocol suite is
covered. Special attention is paid to classless addressing (subnetting, VLSMs,
CIDR, and so on), because it is easily the biggest stumbling block in understanding routing. The Internet runs on CIDR addressed networks now, so it’s

not a topic to be brushed aside. The treatment of this subject matter will not only
leave you with an understanding of classless addressing, you will be able to subnet with ease.
Chapter 2 provides the basis for understanding how routing works. The
explanation starts where routing starts—at the workstation. From there, route
tables and how they are populated are explained.
Chapters 3 and 4 explain how static and dynamic routing work, respectively.
Chapter 4 is a pivotal chapter. Besides an in-depth primer on routing protocols,
the important but elusive topics of route summarization, discontiguous networks, hierarchical addressing, and the longest match principal are covered
as well.
Chapters 5 and 6 cover the two legacy routing protocols, RIP and IGRP.
IGRP does not support classless addressing and was replaced by EIGRP. Its
coverage is somewhat perfunctory, but there is material there that will assist
you in understanding EIGRP. RIP was upgraded to support classless networking so it is still in use, but RIP does not support large networks. Regardless,
read the treatment of RIP, because the coverage lays a foundation for many
topics covered in subsequent chapters.
Chapters 7 and 8 cover the two contemporary routing protocols for large
networks: EIGRP and OSPF. EIGRP is Cisco System’s proprietary entry into
the realm of routing protocols, whereas OSPF is the open standard entry, with
recognition as the recommended interior routing protocol on the Internet. I
have put special effort into the treatment of OSPF, and I think you will feel
quite grounded with the protocol after absorbing the material in Chapter 8.


03_772739 flast.qxp

3/3/06

9:20 PM

Page xxi


Introduction

Chapter 9 provides a cursory introduction to the heady topic of the routing protocol that ties the whole Internet together, namely the Border Gateway
Protocol.
Chapter 10 covers some particulars of routing that are best served up after
spending some time with the routing protocols. Here, the topics of default
routing and route redistribution are taken up.

What’s Not Covered?
Any routing primer should give you an idea of what there is to pursue for further study after you have the basics down. Toward that end, the appendix has
a list of routing topics not covered here.
An assumption is made that you know how to access a router and put it into
programming mode. If that is not so, the appendix has a Web reference that
will help.

Will This Book Help Me Pass a Cisco Test?
Glad you asked. This book is not written as a pass-the-test guide. However, the
material in this book will most certainly help you in a testing environment
because it is designed to help you truly understand the concepts of routing!
Testing these days focuses more on understanding and troubleshooting, and
less on raw facts that can be memorized. Because the book tends to give a more
in-depth treatment of the topics it covers, it in fact provides a foundation for
many of the Cisco certification exams.
So whether you read this book cover-to-cover, or jump right to a chapter of
interest, I think you will find what you’re looking for. Extensive page-level
cross-referencing will enable you to jump to supporting topics with ease.
Best of luck to you with your routing career!

xxi



03_772739 flast.qxp

3/3/06

9:20 PM

Page xxii


04_772739 ch01.qxp

3/3/06

9:20 PM

Page 1

CHAPTER

1
Networking Overview

Overview
The purpose of this chapter is to provide a refresher of basic networking topics related to routing. The following topics are covered:
OSI network model 2
TCP/IP network model 15
Networking equipment 15
Packet forwarding 16

IP addressing 24
Ports and sockets 56
Importatnt Protocols related to routing 59
Based TCP/IP utilities windows 64

1


×