第二章 IP路由
本章目标
通过本章的学习,您应该掌握以下内容:
区分静态、动态路由的不同
设置静态路由
动态路由
距离矢量的路由协议:RIP
链路状态的路由协议:OSPF
什么是路由
要实现路由路由器必须知道:
目的地址
源地址
所有可能的路由路径
最佳路由路径
管理路由信息
Network Protocol
Destination Network
Connected Learned
Exit Interface
E0 S0
路由器必须知道未和其直接相连的目的地址
路由协议和可路由协议
可路由协议( Routed Protocol) :利用网络层完成通信的协议,允许数据包从一个主机主机一寻址方案转发到另一主机。例如;IP;IPX;AppleTalk
路由协议 (Routing Protocol): 本质是创建和维护路由表,可路由协议利用他实现路由功能 例如:RIP;OSPF;BGP;IS-IS 等;
静态路由和动态路由
静态路由
由网络管理员在路由器上手工添加路由信息以实现路由目的
动态路由
根据网络结构或流量的变化,路由协议会自动调整路由信息以实现路由
静态路由的配置
指定一条可以到达目标网络的路径
Router(config)#ip route network [mask]{address|interface}
[next-hop ip address] [preference]
静态路由的例子
Stub Network
ip route
SO
B
Network
A
B
这是一条单方向的路径,必须配置一条相反的路径。
ip route (缺省路由为特殊的静态路由)
自治系统:内部和外部的路由协议
自治系统 100
自治系统 200
IGP: RIP, OSPF等
EGPs: BGP
自治系统:使用相同的路由准则的网络的集合
IGP在一个自治系统内运行。
EGP连接不同的自治系统。
路由协议的分类
距离矢量
混合路由
链路状态
C
B
A
D
C
D
B
A
距离矢量—源信息的获得
路由器从收集到的源信息中选择到达目标地址的最佳路径
A
B
C
E0
S0
S0
S1
S0
E0
Routing Table
0
0
S0
S1
Routing Table
S0
0
E0
0
Routing Table
E0
S0
0
0
距离矢量—源信息的获得
路由器从收集到的源信息中选择到达目标地址的最佳路径
A
B
C
E0
S0
S0
S1
S0
E0
Routing Table
Routing Table
0
0
1
1
S0
S1
S1
S0
Routing Table
S0
0
E0
0
S0
1
E0
S0
S0
1
0
0
距离矢量—源信息的获得
路由器从收集到的源信息中选择到达目标地址的最佳路径
A
B
C
E0
S0
S0
S1
S0
E0
Routing Table
Routing Table
0
0
1
1
S0
S1
S1
S0
Routing Table
S0
0
E0
0
S0
S0
1
2
E0
S0
S0
S0
1
2
0
0
距离矢量—选择最佳路径
10M
1G
10M
1G
B
A
RIP
OSPF
用于确定最佳路由路径的参数信息
链路状态协议原理
路由器找到自己邻居;
每个路由器向邻居发送LSA(link state advertisement) 数据包,包含了自己的路径成本;
LSA扩散,每个路由器都得到相同拓扑结构的数据库;
由SPF算法计算网络可达性,建立SPF树,以自己为树根;
创建路由表,列出最优路径列表;维护其他拓扑结构和状态细节数据库。
链路状态协议
传递最佳的路径信息给其它的路由器
LSA(link state advertisement)数据包
链路状态公告
SPF
运算
拓补结构数据
最佳路由信息
路由表
C
A
D
B
动态路由配置
指定IP路由协议
Router(config)#router protocol [keyword]
Router(config-router)#network network-number
指定与路由器直接相连的网络
RIP 概 述
Hop 计算
路由器每隔30秒更新
最多支持相同hop数的6条路径
10M
1G
1G
1G
RIP 配 置
激活RIP协议
Router(config)#router rip
Router(config-router)#network network-number
选择所能到达的网络
必须是有效的网络
RIP 配置举例
router rip
network
network
router rip
network
router rip
network
network
S2
E0
S3
S2
S3
A
B
C
E0
查看路由表
RouterA#sh ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default
U - per-user static route, o - ODR
T - traffic engineered route
Gateway of last resort is not set
is subnetted, 1 subnets
C is directly connected, Ethernet0
is subnetted, 2 subnets
R [120/1] via , 00:00:07, Serial2
C is directly connected, Serial2
R [120/2] via , 00:00:07, Serial2
S2
E0
S3
S2
S3
A
B
C
E0
OSPF协议概述
无路由自环
可适应大规模网络
路由变化收敛速度快
支持区域划分
支持等值路由
支持验证
支持路由分级管理
支持以组播地址发送协议报文
OSPF协议基本概念
Router ID
一个32-bit的无符号整数,是一台路由器的唯一标识,在整个自治系统内唯一
协议号
OSPF 是基于IP的,其协议号是89
OSPF Header
Protocol #89
OSPF Packet
OSPF的五种协议报文
Hello报文
发现及维持邻居关系,选举DR,BDR
DD报文
本地LSDB的摘要
LSR报文
向对端请求本端没有或对端的更新的LSA
LSU报文
向对方发送其需要的LSA
LSAck报文
收到LSU之后,进行确认
OSPF的邻居状态机
Down
Attempt
Init
2-way
ExStart
Exchange
Loading
Full
划分区域
骨干区域和虚连接
LSA 分类
Router-LSA 由每个路由器生成,描述了路由器的链路状态和花费,传递到整个区域
Network-LSA,由DR生成,描述了本网段的链路状态,传递到整个区域
Net-Summary-LSA,由ABR生成,描述了到区域内某一网段的路由,传递到相关区域
Asbr-Summary-LSA,由ABR生成,描述了到ASBR的路由,传递到相关区域
AS-External-LSA,由ASBR生成,描述了到AS外部的路由,传递到整个AS(STUB区域除外)
网络类型及路由器分类
OSPF协议根据链路层媒体不同分为以下四种网络类型:Broadcast、NBMA、Point-to-Point、Point-to-Multipoint
路由器根据在自治系统中的不同角色划分为:IAR、ABR、BBR、ASBR
一个运行OSPF协议的接口状态根据接口的不同类型可划分为:DR、BDR、DROther、point-to-point
OSPF为什么是无自环的?
每一条LSA(链路状态广播)都标记了生成者(用生成该LSA的路由器的Router ID标记),其它路由器只负责传输。这样不会在传输的过程中发生对该信息的改变或错误理解。
路由计算的算法是SPF算法。计算的结果是一棵树,路由是树上的叶子节点。从根节点到叶子节点是单向不可回复的路径。
本章总结
完成本章的学习后,你应该能够掌握:
何时使用静态路由、何时使用动态路由
在路由器上设置静态路由
描述距离矢量的路由协议的工作原理
在路由器上设置RIP 路由协议
OSPF协议
Purpose: this figure states the chapter objectives.
Emphasize: Read or state each objective so each student has a clear understanding of the chapter objectives.
Purpose: This figure introduces students to routing. The router must accomplish the items listed in the figure for routing to occur.
Emphasize:
Path determination occurs at Layer 3, the network layer. The path determination function enables a router to evaluate the available paths to a destination and to establish the best path.
Routing services use network topology information when evaluating network paths. This information can be configured by the network administrator (static routes) or collected through dynamic processes (routing protocols) running in the network.
Transition:
How do you represent the path to the packet’s destination?
Purpose: This figure introduces students to static and dynamic routes.
Emphasize:
Static knowledge is administered manually—A network administrator enters it into the router’s configuration. The administrator must manually update this static route entry whenever an internetwork topology change requires an update. Static knowledge can be private—by default it is not conveyed to other routers as part of an update process. You can, however, configure the router to share this knowledge.
Dynamic knowledge works differently. After the network administrator enters configuration commands to start dynamic routing, route knowledge is updated automatically by a routing process. Whenever new topology information is received from the internetwork, routers update neighbors about the route change.
Purpose: This figure describes the command syntax used to establish an IP static route.
Emphasize: A static route allows manual configuration of the routing table. No dynamic changes to this table entry will occur as long as the path is active. Routing updates are not sent on a link that is only defined by a static route; hence, conserving bandwidth.
Describe the The ip route field descriptions:
network—destination network or subnet
mask—subnet mask
address—IP address of next hop router
interface—name of interface to use to get to destination network.
Transition: The next figure provides a static route configuration example.
Purpose: This figure gives an example of a static route configuration.
Purpose: This figure discusses autonomous systems, IGPs. and EGPs.
Emphasize: Introduce the interior/exterior distinctions for routing protocols:
Interior routing protocols are used within a single autonomous system
Exterior routing protocols are used to communicate between autonomous systems.
The design criteria for an interior routing protocol require it to find the best path through the network. In other words, the metric and how that metric is used is the most important element in an interior routing protocol.
Exterior protocols are used to exchange routing information between networks that do not share a common administration. IP exterior gateway protocols require the following three sets of information before routing can begin:
A list of neighbor (or peer) routers or access servers with which to exchange routing information
A list of networks to advertise as directly reachable
The autonomous system number of the local router
Purpose: This figure introduces the three classes of routing protocols.
Emphasize: There is no single best routing protocol.
Note: Distance vector routing protocol operation is covered in detail in this course. Link state and hybrid are only briefly explained after the distance vector discussion. Refer students to ACRC to learn more about link state and hybrid routing protocols.
Layer 1 of 3:
Purpose: This figure continues the concept of how a router using a distance vector protocol generally discovers the best path to destinations from each router neighbor.
Emphasize: Layer 1 shows the topology consisting of four networks and three routers. Routing tables inside each router begin with entries for the 0 distance to directly connected networks.
Layer 1 of 3:
Emphasize: Layer 2 adds routing entries received some time later about noncontiguous networks that have distances of 1 from the given routers.
Layer 1 of 3:
Emphasize: Layer 3 adds the final entries received some time later that have distances of 2 from routers A and C.
Emphasize: How the routing algorithm defines “best” determines the most important characteristics of each routing algorithm.
Hop count—Some routing protocols use hop count as their metric. Hop count refers to the number of routers a packet must go through to reach a destination. The lower the hop count, the better the path. Path length is used to indicate the sum of the hops to a destination. As indicated in the figure, RIP uses hop count for its metric.
Ticks—Metric used with Novell IPX to reflect delay. Each tick is 1/18th of a second.
Cost—Factor used by some routing protocols to determine the best path to a destination; the lower the cost, the better the path. Path cost is the sum of the costs associated with each link to a destination.
Bandwidth—Although bandwidth is the rating of a link’s maximum throughput, routing through links with greater bandwidth does not always provide the best routes. For example, if a high-speed link is busy, sending a packet through a slower link might be faster. As indicated in the figure with highlighing,delay and bandwidth are comprise the default metric for IGRP.
Delay—Depends on many factors, including the bandwidth of network links, the length of queues at each router in the path, network congestion on links, and the physical distance to be traveled. A conglomeration of variables that change with internetwork conditions, delay is a common and useful metric. As indicated in the figure with highlighing,delay and bandwidth are comprise the default metric for IGRP.
Load—Dynamic factor can be based on a variety of measures, including CPU use and packets processed per second. Monitoring these parameters on a continual basis can itself be resource intensive.
Purpose: This figure introduces the link-state routing algorithm, the second of the classes of routing protocols, and outlines how it operates.
Emphasize: In contrast with the analogy about the distance vector information being like individual road signs that show distance, link-state information is somewhat analogous to a road map with a “you are here” pointer showing the map reader’s current location. This larger perspective indicates the shortest path to the destination. Each router has its own map of the complete topology.
Link-state routing is not covered further in this course. Refer students interested in more details to the ACRC course.
Purpose: This figure shows the dynamic routing configuration commands.
Emphasize:
The router command starts a routing process. Field descriptions are
protocol—one of the following: RIP, IGRP, HELLO, OSPF, BGP, EGP
autonomous system—used with protocols which require an AS such as IGRP and BGP.
A proper understanding of these commands will avoid many problems in the labs.
The network statement contains no subnetting information. Networks are directly connected and are specified as the major Class A, B, or C network numbers
Transition: The next section describes the RIP routing protocol.
5
Purpose: This figure presents general information about RIP.
Emphasize: The figure shows a network. The arrows highlight the path RIP selects. RIP selects the best path based on shortest hop count so it ignores the path with the faster T1 links.
Be sure that you do not disparage RIP. It was developed in a homogeneous network. If everything is connected via a single media type, then bandwidth-based metrics reduce to hop count. In some cases RIP is more appropriate than other protocols. It is extremely well tested.
Purpose: This figure presents the Cisco IOS commands used to configure RIP.
Emphasize: The figure shows the router rip command and the network network-number command. A proper understanding of these commands will save many problems in the lab.
Point out that the network statement contains no subnetting information.
Networks are directly connected and are specified as a Class A, B, or C network number.
Transition:
An example of configuration follows.
Purpose: The figure shows how the RIP commands operate on the example network.
Emphasize:
An administrator only specifies directly connected networks that he wishes to publish to other routers.
Without the network command, nothing is advertised. With a network command, the router will advertise every subnet within the Class A, B, or C network specified in the configuration.
Purpose: This figure displays the show ip route command which displays the contents of the router’s IP routing table.
Emphasize: Discuss the IP routing table in detail. Show the locations of hop count (metric) and the administrative distance (120).
Discuss the following fields:
R—Refers to routes learned from RIP.
via—Refers to the router that informed us about this route.
00:00:07 timer value—RIP updates are every 30 seconds. Ask, “How long until the next update?”
the interfaces to used for the best path
此页标题禁止有多级标题,更不要出现所在章节的名称。
此页标题要简练,能直接表达出本页的内容。
内容页可以除标题外的任何版式,如图、表等。
该页在授课和胶片+注释中都要使用。
此页标题禁止有多级标题,更不要出现所在章节的名称。
此页标题要简练,能直接表达出本页的内容。
内容页可以除标题外的任何版式,如图、表等。
该页在授课和胶片+注释中都要使用。
此页标题禁止有多级标题,更不要出现所在章节的名称。
此页标题要简练,能直接表达出本页的内容。
内容页可以除标题外的任何版式,如图、表等。
该页在授课和胶片+注释中都要使用。
此页标题禁止有多级标题,更不要出现所在章节的名称。
此页标题要简练,能直接表达出本页的内容。
内容页可以除标题外的任何版式,如图、表等。
对于只授课用的胶片,文字字体可以调整,但必须统一:
一级文字为24号,二级文字为20号,三级文字为18号,四级文字为16号。
该页在授课和胶片+注释中都要使用。
此页标题禁止有多级标题,更不要出现所在章节的名称。
此页标题要简练,能直接表达出本页的内容。
内容页可以除标题外的任何版式,如图、表等。
对于只授课用的胶片,文字字体可以调整,但必须统一:
一级文字为24号,二级文字为20号,三级文字为18号,四级文字为16号。
该页在授课和胶片+注释中都要使用。
此页标题禁止有多级标题,更不要出现所在章节的名称。
此页标题要简练,能直接表达出本页的内容。
内容页可以除标题外的任何版式,如图、表等。
对于只授课用的胶片,文字字体可以调整,但必须统一:
一级文字为24号,二级文字为20号,三级文字为18号,四级文字为16号。
该页在授课和胶片+注释中都要使用。
此页标题禁止有多级标题,更不要出现所在章节的名称。
此页标题要简练,能直接表达出本页的内容。
内容页可以除标题外的任何版式,如图、表等。
该页在授课和胶片+注释中都要使用。
此页标题禁止有多级标题,更不要出现所在章节的名称。
此页标题要简练,能直接表达出本页的内容。
内容页可以除标题外的任何版式,如图、表等。
该页在授课和胶片+注释中都要使用。
此页标题禁止有多级标题,更不要出现所在章节的名称。
此页标题要简练,能直接表达出本页的内容。
内容页可以除标题外的任何版式,如图、表等。
该页在授课和胶片+注释中都要使用。
Purpose: Review the summary items with your students.
Emphasize: Read or restate the summary statements. By now, your presentation and classroom discussion should have students able to meet the chapter learning objectives.