目的三, 我们先来看一下OSPF的数据库, 了解LSA-1里面的一些内容:
R3#show ip ospf database router
OSPF Router with ID ( 3.3.3 .3) (Process ID 10)
Router Link States (Area 0)
LS age: 556
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 1.1.1 .1
Advertising Router: 1.1.1 .1
LS Seq Number: 80000007
Checksum: 0x5BEE
Length: 84
Number of Links: 5
Link connected to: a Stub Network
(Link ID) Network/subnet number: 12.1.1 .0
(Link Data) Network Mask: 255.255.255.0
Number of TOS metrics: 0
TOS 0 Metrics: 100
LS age: 1168
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 2.2.2 .2
Advertising Router: 2.2.2 .2
LS Seq Number: 80000005
Checksum: 0xCB4E
Length: 84
Number of Links: 5
Link connected to: a Stub Network
(Link ID) Network/subnet number: 12.1.1 .0
(Link Data) Network Mask: 255.255.255.0
Number of TOS metrics: 0
TOS 0 Metrics: 110
R3
只是提取到同一网络最小
Metrics
值
,
再和自己计算的链路
COST,
做累加
100+64=164,
装进路由表
!
目的四
, R1
上加一台路由
R4,
相当于
:R4=>R1=>R2=>R3
串连
,
拓扑如下
:
R4
正确配置
,
DOWN
掉
R1
的
S2/0
端口
,
现在我们来看一下
, R4
到达
3.3.3
.0/24
网络
,
采用的是
R1
的
100?
还是
R2
的
110 ?
反之
, R3
到
4.4.4
.0/24
呢
?
R4
通过
E0/0
连接
R1,
并宣告进
OSPF
区域
0:
R4#
router ospf 10
router-id 4.4.4 .4
network 4.4.4 .0 0.0.0.255 area 0
network 14.1.1 .0 0.0.0.255 area 0
R4#
show ip route
Gateway of last resort is not set
1.0.0 .0/32 is subnetted, 1 subnets
O 1.1.1 .1 [110/11] vi a 14.1.1 .1, 00:05:49, Ethernet0/0
2.0.0 .0/32 is subnetted, 1 subnets
O 2.2.2 .2 [110/111] vi a 14.1.1 .1, 00:05:49, Ethernet0/0
3.0.0 .0/32 is subnetted, 1 subnets
O 3.3.3 .3 [110/175] vi a 14.1.1 .1, 00:05:49, Ethernet0/0
4.0.0 .0/24 is subnetted, 1 subnets
C 4.4.4 .0 is directly connected, Loopback0
23.0.0 .0/24 is subnetted, 1 subnets
O 23.1.1 .0 [110/174] vi a 14.1.1 .1, 00:05:49, Ethernet0/0
12.0.0 .0/24 is subnetted, 1 subnets
O 12.1.1 .0 [110/110] vi a 14.1.1 .1, 00:05:49, Ethernet0/0
14.0.0 .0/24 is subnetted, 1 subnets
C 14.1.1 .0 is directly connected, Ethernet0/0
R3#show ip route
Gateway of last resort is not set
1.0.0 .0/32 is subnetted, 1 subnets
O 1.1.1 .1 [110/175] vi a 23.1.1 .2, 00:07:02, Serial2/0
2.0.0 .0/32 is subnetted, 1 subnets
O 2.2.2 .2 [110/65] vi a 23.1.1 .2, 00:07:02, Serial2/0
3.0.0 .0/24 is subnetted, 1 subnets
C 3.3.3 .0 is directly connected, Loopback0
4.0.0 .0/32 is subnetted, 1 subnets
O 4.4.4 .4 [110/185] vi a 23.1.1 .2, 00:07:02, Serial2/0
23.0.0 .0/24 is subnetted, 1 subnets
C 23.1.1 .0 is directly connected, Serial2/0
12.0.0 .0/24 is subnetted, 1 subnets
O 12.1.1 .0 [110/174] vi a 23.1.1 .2, 00:07:02, Serial2/0
14.0.0 .0/24 is subnetted, 1 subnets
O 14.1.1 .0 [110/184] vi a 23.1.1 .2, 00:07:03, Serial2/0
结论
:
R4=>R1=>R2=>R3
COST=10+100+64+1
R3=>R2=>R1=>R4
COST=64+110+10+1
五,实验总结:
任何OSPF路由器,都是以自己为根, 通过链路状态, 计算出一棵树!
实验证明了
COST
值的累加
,
这里又有点距离矢量加跳数的意思
. 错!
这个累加和(175)只是R4自己的动作! 所累加的每个COST值是每台路由器通告的最原始的!
对于
R4
而言
,
自己为根
,
最近的枝就是
R1,
通过
R1
的
S1/0
端口到达
12.1.1
.0/24,
以及后面的网络
,
就算
R2
的
LSA
里的Metrics再小也不会采用!
R3
则相反
,
反之亦然
!
总结一句, 更改COST值时, 以目的网络为参考点, 所做的COST/参数改动,只对
其上游路由器 (包括本路由) 选路起作用!!!