OSPF 实战篇
通过基础篇和进阶篇的学习,我想你已经具备了充足的知识,废话少说,既然是实战篇就要通过试验来学习 OSPF,下面我们通过 8个实验来检验一下你掌握的如何。
试验一:配置 OSPF和监控
试验二:建立邻接关系
试验三: 配置点对点链路
试验四:配置 OSPF over NBMA 网络类型
试验五:配置 Stub、Totally Stub、NSSA
试验六:了解 OSPF Database这应该算是个重点了!
试验七:配置虚链路
试验八:重分布 Rip 进 OSPF
Lab 1: 配置 OSPF和监控
试验的目的:
1.完成 OSPF配置
2.检验 OSPF的运行状态
3.掌握一些配置命令
试验思路:
这是最最简单的配置 因为只有一台路由器,路由器 F的 E1口连接主干区域, s2配置了子接口
首先用 sh ip interface brief 看看接口配置
E0端口 down
E1为 170.170.4.6
然后在看看 s2串口的配置信息
看到串口 2为帧中继,配置为点对点字接口,每个接口为 1个子网
下面我们来配置 ospf
配置 ospf进程号为 7
广播网络 170.170.4.0/24 (就是 e1端口)到区域 0
广播网络 170.170.11.0/24和 10.0/24 到区域 1
配置完了,简单吧,呵呵
下面来检验一下:
用 sh ip ospf 检查一下 ospf的配置信息
Router_F#show ip ospf
Routing Process "ospf 7" with ID 170.170.11.6路由器 ID
Supports only single TOS(TOS0) routes
It is an area border router表示此路由器为 ABR
SummaryLink updateintervalis00:30:00andthe updateduein 00:22:11
SPF schedule delay 5 secs, Hold time between two SPFs 10 secs
Number of DCbitless external LSA 0
Number of DoNotAge external LSA 0
Number of areas in this router is 2. 2 normal 0 stub 0 nssa
Area BACKBONE(0) (Inactive)主干区域
Number of interfaces in this area is 1在主干域的接口为 1
Area has no authentication区域未配置认证
SPF algorithm executed 4 times SPF计算次数
Area ranges are路由聚合
Link State Update Interval is 00:30:00 and due in 00:21:57
Link State Age Interval is 00:20:00 and due in 00:11:57
Number of DCbitless LSA 0
Number of indication LSA 0
Number of DoNotAge LSA 0
Area 1
Number of interfaces in this area is 2在区域 1的接口数量为 2
Area has no authentication区域未配置认证
SPF algorithm executed 3 times SPF计算次数
Area ranges are路由聚合
Link State Update Interval is 00:30:00 and due in 00:22:08
Link State Age Interval is 00:20:00 and due in 00:12:08
Number of DCbitless LSA 0
Number of indication LSA 0
Number of DoNotAge LSA 0
Router_F#
通过上条命令可检查 ospf协议的基本信息
接下来我们检查一下主干域接口 E1 的 ospf信息:用命令 sho ip ospf int e1
Router_F#show ip ospf interface ethernet 1
Ethernet1 is up, line protocol is up
Internet Address 170.170.4.6/24, Area 0表示接口属于主干域
Process ID 7, Router ID 170.170.11.6, Network Type BROADCAST, Cost:
10网络类型和接口成本
Transmit Delay is 1 sec, State DR, Priority 1 表示自己是
DR,优先级为 1 Designated Router (ID) 170.170.11.6, Interface address 170.170.4.6
No backup designated router on this network
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit
5 hello和 dead的计时器
Hello due in 00:00:05 Neighbor Count is 0, Adjacent neighbor count is 0表示此接口没有邻
居
Suppress hello for 0 neighbor(s)
Router_F#
通过此命令检查 ospf的接口信息,包括接口成本,接口区域,计时器,邻居,优先级,dr
等等
用命令 show ip ospf interface 可查看所有接口的 ospf状态。
本试验完成。
Lab2:建立邻接关系
试验目的:
在路由器 D上配置 ospf以建立和路由器 F的邻接关系
检验邻居关系
试验思路:
路由器 F已经配置完毕了,那么开始配置路由器 D了,基本和路由器 F的配置一样
首先还是查看路由器 D的接口信息,或者打 sho run看一下都行
也可用 show ip proto看看配置的路由协议。
然后配置 ospf协议
Router_D(config)#router ospf 7
Router_D(config-router)#network 170.170.4.0 0.0.0 .255 area 0
Router_D(config-router)#end
这样就把 e1端口广播到主干域,想想下一步应该还配置什么呢?
没有了,^_^ 那我们检查一下邻居关系看看
在路由器 F上启用 debug 看看邻居状态
Router_F#debug ip ospf adj
OSPF adjacency events debugging is on
Router_F#
然后看看 show logging
OSPF: Rcv hello from 170.170.8.4 area 0 from Ethernet1 170.170.4.4
OSPF: End of hello processing
OSPF: Rcv DBD from 170.170.8.4 on Ethernet1 seq 0x1036 opt 0x2 flag 0x7 len 32
state INIT
OSPF: 2 Way Communication to 170.170.8.4 on Ethernet1, state 2WAY
OSPF: Neighbor change Event on interface Ethernet1
OSPF: DR/BDR election on Ethernet1
OSPF: Elect BDR 170.170.8.4
OSPF: Elect DR 170.170.11.6
DR: 170.170.11.6 (Id) BDR: 170.170.8.4 (Id)
OSPF: Send DBD to 170.170.8.4 on Ethernet1 seq 0x2346 opt 0x2 flag 0x7 Len 32
OSPF: First DBD and we are not SLAVE
OSPF: Rcv DBD from 170.170.8.4 on Ethernet1 seq 0x2346 opt 0x2 flag 0x2 Len 132
state EXSTART
OSPF: NBR Negotiation Done. We are the MASTER
OSPF: Send DBD to 170.170.8.4 on Ethernet1 seq 0x2347 opt 0x2 flag 0x3 Len 112
OSPF: Database request to 170.170.8.4
OSPF: sent LS REQ packet to 170.170.4.4, length 24
OSPF: Rcv DBD from 170.170.8.4 on Ethernet1 seq 0x2347 opt 0x2 flag 0x0 Len 32
state EXCHANGE
OSPF: Send DBD to 170.170.8.4 on Ethernet1 seq 0x2348 opt 0x2 flag 0x1 Len 32
OSPF: Rcv DBD from 170.170.8.4 on Ethernet1 seq 0x2348 opt 0x2 flag 0x0 Len 32
state EXCHANGE
OSPF: Exchange Done with 170.170.8.4 on Ethernet1
OSPF: Build router LSA for area 0, router ID 170.170.11.6
OSPF: Build network LSA for Ethernet1, router ID 170.170.11.6
OSPF: No full nbrs to build Net Lsa
OSPF: Flush network LSA on Ethernet1 for area 0
OSPF: Synchronized with 170.170.8.4 on Ethernet1, state FULL
如果你有耐性看的话那么你将会看到 ospf建立邻接的各个状态的顺序
在用 show ip ospf nei看看邻居的状态
Router_F#show ip ospf neighbor
Neighbor ID
Interface
Pri State Dead Time Address 170.170.8.4
Ethernet1
1 FULL/BDR 00:00:37 170.170.4.4
Router_F#
Router_D#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address
Interface
170.170.11.6 1 FULL/DR 00:00:32 170.170.4.6
Ethernet1
Router_D#
可以看到路由器 F是 DR,路由器 D是 BDR,并且都是 Full状态,邻居已经形成
本次试验完成。
Lab 3: 配置点对点链路
配置思路:
路由器 D和路由器 F已经配置完了,那么接下来配置 Area 1 了,大家记得路由器 F的 s2
是配置的帧中继字接口吧。点对点字接口配置很简单,不用什么特别配置。在路由器 F上已经将 s2.7和 s2.8配置到 area 1了,下面就在路由器 G和 H上配置 ospf协议了
Router_G(config)#router ospf 7
Router_G(config-router)#network 170.170.11.0 0.0.0 .255 area 1
Router_G(config-router)#network 170.170.5.0 0.0.0 .255 area 1
Router_G(config-router)#end
Router_G#
Router_H(config)#router ospf 7
Router_H(config-router)#network 170.170.10.0 0.0.0 .255 area 1
Router_H(config-router)#network 170.170.14.0 0.0.0 .255 area 1
Router_H(config-router)#end
Router_H#
接下来我们来检查一下邻接状态,在路由器 G上打 sho ip ospf neig
Router_G#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
170.170.11.6 1 FULL/ - 00:00:30 170.170.11.6 Serial0.6
Router_G#
之所以没有 DR和 BDR是因为在点对点上是没有 dr的,路由器 H和路由器 G一样也和
F建立了邻接。
路由器 F和 D,H建立了邻接,也从他们那里学到了路由: 170.170.5.0/24 170.170.14.0/24. 那么到这两条路径的度量值是多少呢,可以在 F上打 sho ip ospf int s2.7
Router_F#show ip ospf interface serial 2.7
Serial2.7 is up, line protocol is up
Internet Address 170.170.11.6/24, Area 1
Process ID 7, Router ID 170.170.11.6, Network Type POINT_TO_POINT,
Cost: 64
Transmit Delay is 1 sec, State POINT_TO_POINT,
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit
5
Hello due in 00:00:03
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 170.170.11.7
Suppress hello for 0 neighbor(s)
Router_F#
这个端口的成本是 64,那么加上 e0的成本是 10( 10M 的成本是 10, 100M 的是 1),就是 74,在路由表中检查一下。
Router_F#show 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
Gateway of last resort is not set
170.170.0.0/24 is subnetted, 5 subnets
C 170.170.4.0 is directly connected, Ethernet1
O 170.170.5.0 [110/74] via 170.170.11.7, 00:26:49, Serial2.7
C 170.170.10.0 is directly connected, Serial2.8
C 170.170.11.0 is directly connected, Serial2.7
O 170.170.14.0 [110/74] via 170.170.10.8, 00:26:49, Serial2.8
Router_F#
果然是 74
本次试验完成。
Lab 4:配置 OSPF over NBMA 网络类型
试验目的:
在路由器 E和 F上配置 ep接口建立邻接
配置 NBMA成广播类型
配置 NBMA成点对多点
配置思路:
现在多了个路由器 E,配置 e0和路由器 F邻接很简单,关键是 s1端口的帧中继设置,下面来看看如何配置。
先配置路由器 E和 F建立邻接。
配置很简单:
Router_E(config)#router ospf 7
Router_E(config-router)#network 170.170.6.0 0.0.0 .255 area 0
Router_E(config-router)#end
Router_E#
配置 NBMA为广播模式
早先 IOS 10.0以前,需要用 neighbor命令手工指定邻居,现在的 IOS用 ip ospf
network来改变 ospf的接口类型,ip ospf network broadcast 命令可将接口
改为广播模式,这样在路由器 E、G、H之间的接口就改为广播接口
上面是路由器 E的 s1配置,有到路由器 G 170.170.9.7 和路由器 H的 map
上面是路由器 G的 s0.5配置,有到路由器 E的 map
上面是路由器 H的 s0.5配置,有到路由器 E的 map
因为这个网络不是全连通的网络,那个要成为 DR呢?想一想,应该是 E,因为它连接着 G和 H,需要在 G和 H上改成不进行选举的模式,用下面这条命令。
Router_G(config-subif)#ip ospf priority 0
Router_G(config-subif)#
配置 G和 H的 ospf
Router_H(config-subif)#router ospf 7
Router_H(config-router)#network 170.170.9.0 0.0.0 .255 area 1
Router_H(config-router)#network 170.170.14.0 0.0.0 .255 area 1
Router_H(config-router)#end
Router_H#
同样配置 G,然后在接口上配置 ip ospf network broadcast
我们在路由器 G上检查一下邻居状态
Router_G#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
170.170.9.5 1 FULL/DR 00:00:35 170.170.9.5 Serial0.5
170.170.11.6 1 FULL/ - 00:00:35 170.170.11.6 Serial0.6
Router_G#
可看到 170.170.9.5 为 DR,也就是路由器 E,因为 G和 H不参与竞争
我们看看这样导致什么问题,我们在路由器 G上 ping H的 e0口 170.170.14.8
从路由器 H ping G的 e0口 170.170.5.7
Router_G#ping 170.170.14.8
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 170.170.14.8, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
Router_G#
为什么会失败呢?
我们看看路由表
Router_G#show 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
Gateway of last resort is not set
170.170.0.0/24 is subnetted, 7 subnets
O IA 170.170.4.0 [110/74] via 170.170.11.6, 23:02:07, Serial0.6
C 170.170.5.0 is directly connected, Ethernet0
O IA 170.170.6.0 [110/74] via 170.170.11.6, 23:02:07, Serial0.6
[110/74] via 170.170.9.5, 23:02:07, Serial0.5
C 170.170.9.0 is directly connected, Serial0.5
O 170.170.10.0 [110/128] via 170.170.11.6, 23:02:07, Serial0.6
[110/128] via 170.170.9.8, 23:02:07, Serial0.5
C 170.170.11.0 is directly connected, Serial0.6
O 170.170.14.0 [110/74] via 170.170.9.8, 23:02:07, Serial0.5
Router_G#
有到 14.0的路由,为什么不通呢,看一下后面的就口 170.170.9.8,是从这里传过来的
因为配置成 broadcast模式,链路被看作成一条多路访问链路,如以太网;所以路由器
G认为路由器 H和自己连在一起,共同在同一网段,和以太网一样,所以用
H作为下一跳地址。为什么用 H做下一跳失败呢,因为 G和 H没有 PVC连接,G没有
2个 Layer 2-to-Layer 3地址映射,路由器 H的 ip地址不能映射到帧中继头中,在以太网中,可用 MAC来映射。在帧中继中要用 DLCI来映射 IP地址。
知道问题所在,我们来配置一条 pvc映射
Router_G(config)#int s 0.5 mult
Router_G(config-subif)#frame-relay map ip 170.170.9.8 112 broadcast
Router_G(config-subif)#end
Router_G#
同样,在路由器 H上,配置一条映射用来到路由器 G的 170.170.5.0/24网络
Router_H(config-subif)#frame-relay map ip 170.170.9.7 132 broadcast
现在 ping一下
Router_G#ping 170.170.14.8
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 170.170.14.8, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 52/52/56 ms
Router_G#
现在通了吧,^_^
以上的问题看看点对多点是如何解决的
在路由器 G上将映射到 H上那个 pvc去掉
Router_G(config)#int s 0.5 mult
Router_G(config-subif)#no frame-relay map ip 170.170.9.8 112 broadcast
Router_G(config-subif)#end
Router_G#
同样去掉 H的 pvc 按配置 broadcast的方法配置成 point-to-multipoint
Router_E(config)#interface serial 1
Router_E(config-if)#ip ospf network point-to-multipoint
Router_E(config-if)#end
Router_E#
在 G和 H上配置
interface serial 0.5
ip ospf network point-to-multipoint
在路由器 G上 ping H 的 e0口
Router_G#ping 170.170.14.8
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 170.170.14.8, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/28/40 ms
Router_G#
现在通了,没有配置 pvc映射,怎么和刚才 broadcast类型不同呢?
看看路由表
Router_G#show 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
Gateway of last resort is not set
170.170.0.0/16 is variably subnetted, 9 subnets, 2 masks
O 170.170.9.8/32 [110/128] via 170.170.11.6, 01:02:11, Serial0.6
[110/128] via 170.170.9.5, 01:02:11, Serial0.5
O IA 170.170.4.0/24 [110/74] via 170.170.11.6, 01:02:11, Serial0.6
C 170.170.5.0/24 is directly connected, Ethernet0
O IA 170.170.6.0/24 [110/74] via 170.170.11.6, 01:02:11, Serial0.6
[110/74] via 170.170.9.5, 01:02:11, Serial0.5
C 170.170.9.0/24 is directly connected, Serial0.5
O 170.170.10.0/24 [110/128] via 170.170.11.6, 01:02:11, Serial0.6
C 170.170.11.0/24 is directly connected, Serial0.6
O 170.170.9.5/32 [110/64] via 170.170.9.5, 01:02:12, Serial0.5
O 170.170.14.0/24 [110/138] via 170.170.11.6, 01:02:12, Serial0.6
[110/138] via 170.170.9.5, 01:02:12, Serial0.5
点对多点会产生邻居间的主机路由,不用建立 pvc的映射关系,并且 170.170.14.0/24的下一跳改成 9.5了也就是路由器 E。
本次试验完毕。
Lab 5:配置 Stub、Totally Stub、NSSA
试验目的:
依次配置 3个区域总结各个类型的特点
试验思路:
路由器 C在 area 2 和路由器 E邻接,E是 ABR,将 C配置成 3个区域类型,观察路由表的变化。
配置:
首先配置 E和 C的 ospf
Router_E:
router ospf 7
network 170.170.2.0 0.0.0 .255 area 2
Router_C:
router ospf 7
network 170.170.2.0 0.0.0 .255 area 2
这个试验路由器 D的 170.170.5.0/24没有参与 ospf,我们可以重分布到 ospf中,用命令
Router_D(config)#router ospf 7
Router_D(config-router)#redistribute connected subnets
Router_D(config-router)#end
Router_D#
这样路由器 D就成了 ASBR
看看路由器 C的路由表
Router_C#show 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
Gateway of last resort is not set
170.170.0.0/16 is variably subnetted, 12 subnets, 2 masks
O IA 170.170.9.8/32 [110/128] via 170.170.2.5, 02:24:07, Serial0
C 170.170.2.0/24 is directly connected, Serial0
O E2 170.170.3.0/24 [110/20] via 170.170.2.5, 02:24:07, Serial0
O IA 170.170.4.0/24 [110/84] via 170.170.2.5, 02:24:07, Serial0
O IA 170.170.5.0/24 [110/138] via 170.170.2.5, 02:24:07, Serial0
O IA 170.170.6.0/24 [110/74] via 170.170.2.5, 02:24:07, Serial0
O IA 170.170.10.0/24 [110/192] via 170.170.2.5, 02:24:07, Serial0
O IA 170.170.11.0/24 [110/192] via 170.170.2.5, 02:24:07, Serial0
O IA 170.170.9.5/32 [110/64] via 170.170.2.5, 02:24:08, Serial0
O IA 170.170.14.0/24 [110/138] via 170.170.2.5, 02:24:08, Serial0
O IA 170.170.9.7/32 [110/128] via 170.170.2.5, 02:24:08, Serial0
C 170.170.15.0/24 is directly connected, Ethernet0
Router_C#
E2是路由器 D发进来的外部路由
下面配置路由器 C为 Stub域:
Router_C(config)#router ospf 7
Router_C(config-router)#area 2 stub
Router_C(config-router)#end
Router_E(config)#router ospf 7
Router_E(config-router)#area 2 stub
Router_E(config-router)#end
再看看路由器 C的路由表:
Router_C#show 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
Gateway of last resort is 170.170.2.5 to network 0.0.0 .0
170.170.0.0/16 is variably subnetted, 11 subnets, 2 masks
O IA 170.170.9.8/32 [110/128] via 170.170.2.5, 00:24:28, Serial0
C 170.170.2.0/24 is directly connected, Serial0
O IA 170.170.4.0/24 [110/84] via 170.170.2.5, 00:24:28, Serial0
O IA 170.170.5.0/24 [110/138] via 170.170.2.5, 00:24:28, Serial0
O IA 170.170.6.0/24 [110/74] via 170.170.2.5, 00:24:28, Serial0
O IA 170.170.10.0/24 [110/192] via 170.170.2.5, 00:24:28, Serial0
O IA 170.170.11.0/24 [110/192] via 170.170.2.5, 00:24:28, Serial0
O IA 170.170.9.5/32 [110/64] via 170.170.2.5, 00:24:28, Serial0
O IA 170.170.14.0/24 [110/138] via 170.170.2.5, 00:24:29, Serial0
O IA 170.170.9.7/32 [110/128] via 170.170.2.5, 00:24:29, Serial0
C 170.170.15.0/24 is directly connected, Ethernet0
O*I A 0.0.0 .0/0 [110/65] via 170.170.2.5, 00:24:29, Serial0
刚才的 E2路由没了,又多了条默认路由,这是 stub的特点,不接收 type5 lsa,abr产生一
条默认路由发给内部路由器。
用下面的命令检查路由器 C的类型:
Router_E#show ip ospf
Routing Process "ospf 7" with ID 170.170.9.5
Supports only single TOS(TOS0) routes
It is an area border router
SummaryLink updateintervalis00:30:00andthe updateduein 00:17:25
SPF schedule delay 5 secs, Hold time between two SPFs 10 secs
Number of DCbitless external LSA 0
Number of DoNotAge external LSA 0
...(some output omitted)...
Area 2
Number of interfaces in this area is 1
It is a stub area
generates stub default route with cost 1
在将路由器 C配置成 Tollaly Stub区域:
在 C和 E上配置
configure terminal
router ospf 7
area 2 stub no-summary
在检查 C的路由表:
Router_C#show 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
Gateway of last resort is 170.170.2.5 to network 0.0.0 .0
170.170.0.0/24 is subnetted, 2 subnets
C 170.170.2.0 is directly connected, Serial0
C 170.170.15.0 is directly connected, Ethernet0
O*I A 0.0.0 .0/0 [110/65] via 170.170.2.5, 00:04:29, Serial0
Router_C#
现在只有一条默认路由了,Tollaly Stub类型只接收默认路由和域内路由。
Router_C#show ip ospf
Routing Process "ospf 7" with ID 170.170.15.3
Supports only single TOS(TOS0) routes
SPF schedule delay 5 secs, Hold time between two SPFs 10 secs
Number of DCbitless external LSA 0
Number of DoNotAge external LSA 0
Number of areas in this router is 1. 0 normal 1 stub 0 nssa
Area 2
Number of interfaces in this area is 1
It is a stub area, no summary LSA in this area
将路由器配成 NSSA区域:在路由器 C和 E上配置
configure terminal
router ospf 7
no area 2 stub no-summary
我们刚才配置路由器 C的时候没有把 170.170.15.0/24加入 ospf,现在用
configure terminal
router ospf 7
redistribute connected subnets
end
将路由器 C配置成 ASBR,这样就可将 15.0/24网段以外部路由形式发往
E 然后在配置成 NSSA模式
configure terminal
router ospf 7
no area 2 stub
area 2 nssa
查看 C的路由表:
Router_C#show 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 Gateway of last resort is not set
170.170.0.0/16 is variably subnetted, 11 subnets, 2 masks
O IA 170.170.9.8/32 [110/128] via 170.170.2.5, 00:00:26, Serial0
C 170.170.2.0/24 is directly connected, Serial0
O IA 170.170.4.0/24 [110/84] via 170.170.2.5, 00:00:26, Serial0
O IA 170.170.5.0/24 [110/138] via 170.170.2.5, 00:00:26, Serial0
O IA 170.170.6.0/24 [110/74] via 170.170.2.5, 00:00:26, Serial0
O IA 170.170.10.0/24 [110/192] via 170.170.2.5, 00:00:26, Serial0
O IA 170.170.11.0/24 [110/192] via 170.170.2.5, 00:00:26, Serial0
O IA 170.170.9.5/32 [110/64] via 170.170.2.5, 00:00:26, Serial0
O IA 170.170.14.0/24 [110/138] via 170.170.2.5, 00:00:27, Serial0
O IA 170.170.9.7/32 [110/128] via 170.170.2.5, 00:00:27, Serial0
C 170.170.15.0/24 is directly connected, Ethernet0
Router_C#
看看有什么变化?NSSA接收 type 3 LSA,看不到那个外部路由,以为是 15.0是直连的,
NSSA也没有缺省路由,因为 NSSA类型 ABR是不产生缺省路由的。
看看路由器 E的路由表:
Router_E#show 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
Gateway of last resort is not set
170.170.0.0/16 is variably subnetted, 12 subnets, 2 masks
O 170.170.9.8/32 [110/64] via 170.170.9.8, 00:06:27, Serial1
C 170.170.2.0/24 is directly connected, Serial0
O E2 170.170.3.0/24 [110/20] via 170.170.6.6, 00:06:07, Ethernet0
O 170.170.4.0/24 [110/20] via 170.170.6.6, 00:06:27, Ethernet0
O 170.170.5.0/24 [110/74] via 170.170.9.7, 00:06:27, Serial1
C 170.170.6.0/24 is directly connected, Ethernet0
C 170.170.9.0/24 is directly connected, Serial1
O 170.170.10.0/24 [110/128] via 170.170.9.8, 00:06:27, Serial1
O 170.170.11.0/24 [110/128] via 170.170.9.7, 00:06:27, Serial1
O 170.170.14.0/24 [110/74] via 170.170.9.8, 00:06:28, Serial1
O 170.170.9.7/32 [110/64] via 170.170.9.7, 00:06:28, Serial1
O N2 170.170.15.0/24 [110/20] via 170.170.2.3, 00:06:08, Serial0
Router_E#
N2表示 type 7的外部路由类型 7的路由传播到其他路由器之前要转换到 5才行,我们可以用下面的命令检查
Router_E#show ip ospf
Routing Process "ospf 7" with ID 170.170.9.5
Supports only single TOS(TOS0) routes
It is an area border and autonomous system boundary router
SummaryLink updateintervalis00:30:00andthe updateduein 00:25:26
External Link update interval is 00:30:00 and the update due in
00:25:27
Redistributing External Routes from,
SPF schedule delay 5 secs, Hold time between two SPFs 10 secs
...(some output omitted)...
Area 2
Number of interfaces in this area is 1
It is a NSSA area
Perform type-7/type-5 LSA translation
Area has no authentication
SPF algorithm executed 9 times
Area ranges are
Link State Update Interval is 00:30:00 and due in 00:25:25
Link State Age Interval is 00:20:00 and due in 00:15:25
Number of DCbitless LSA 0
Number of indication LSA 0
Number of DoNotAge LSA 0
那如何让 NSSA产生默认路由呢,在 E上用下面的命令:
configure terminal
router ospf 7
area 2 nssa default-information-originate
在查看路由器 C的表
Router_C#show 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 Gateway of last resort is
170.170.2.5...
170.170.0.0/16 is variably subnetted, 11 subnets, 2 masks
O IA 170.170.9.8/32 [110/128] via 170.170.2.5, 00:00:40, Serial0
C 170.170.2.0/24 is directly connected, Serial0
O IA 170.170.4.0/24 [110/84] via 170.170.2.5, 00:00:40, Serial0
O IA 170.170.5.0/24 [110/138] via 170.170.2.5, 00:00:40, Serial0
O IA 170.170.6.0/24 [110/74] via 170.170.2.5, 00:00:40, Serial0
O IA 170.170.10.0/24 [110/192] via 170.170.2.5, 00:00:40, Serial0
O IA 170.170.11.0/24 [110/192] via 170.170.2.5, 00:00:40, Serial0
O IA 170.170.9.5/32 [110/64] via 170.170.2.5, 00:00:40, Serial0
O IA 170.170.14.0/24 [110/138] via 170.170.2.5, 00:00:40, Serial0
O IA 170.170.9.7/32 [110/128] via 170.170.2.5, 00:00:40, Serial0
C 170.170.15.0/24 is directly connected, Ethernet0
O*N2 0.0.0 .0/0 [110/1] via 170.170.2.5, 00:00:40, Serial0
Router_C#
有缺省路由了在路由器 E上检查缺省路由情况:
Router_E#show ip ospf
Routing Process "ospf 7" with ID 170.170.9.5
Supports only single TOS(TOS0) routes
It is an area border and autonomous system boundary router
Summary Link update interval is 00:30:00 and the update due in 00:20:13
ExternalLinkupdateintervalis00:30:00andtheupdateduein00:01:05
Redistributing External Routes from,
..(some output omitted)...
Area 2
Number of interfaces in this area is 1
It is a NSSA area
Perform type-7/type-5 LSA translation
generates NSSA default route with cost 1
NSSA是接收 type 3和外部路由的,能不能不接收呢?
用下面的命令配置
configure terminal
router ospf 7
area 2 nssa no-summary
在查看 C路由表:
Router_C#show 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
Gateway of last resort is 170.170.2.5 to network 0.0.0 .0
170.170.0.0/24 is subnetted, 2 subnets
C 170.170.2.0 is directly connected, Serial0
C 170.170.15.0 is directly connected, Ethernet0
O*I A 0.0.0 .0/0 [110/65] via 170.170.2.5, 00:01:37, Serial0
Router_C#
整个世界清净了!
Lab 6:了解 OSPF Database这应该算是个重点了!
试验目的:
这个试验我们要学习 OSPF的 Database,知道如何显示各种 LSA,以及如何检查。
试验思路:
其实就要记住几个显示的命令,就可以了,主要就是学会怎么看输出结果。
上面的拓扑,有主干域,非主干域, ASBR,ABR,应该各种
LSA都有,下面来看看怎么
查看。
先要记住,在同一个区域内的路由器的链路数据库都是完全一样的。
查看的命令很简单
show ip ospf database
学会查看链路数据库对排错很有帮助在路由器 E上输入上面的命令
Router_E#show ip ospf database
...(output omitted)...
Router Link States (Area 0) 主干域所有路由器产生的
LSA,LSID是路由器 ID
Link ID ADV Router Age Seq# Checksum Link count
170.170.8.4 170.170.8.4 85 0x800001B0 0x8374 1
170.170.9.5 170.170.9.5 456 0x 800001F 1 0x1698 1
170.170.11.6 170.170.11.6 468 0x800001EB 0xAC29 2
...(output omitted)...
Router Link States (Area 1)区域 1的
LSA type 1
Link ID ADV Router Age Seq# Checksum Link count
170.170.9.5 170.170.9.5 459 0x 800001F 9 0xAF28 3
170.170.11.6 170.170.11.6 816 0x800001E3 0x8B 6A 4
170.170.11.7 170.170.11.7 472 0x 800002A 7 0xB449 5
170.170.14.8 170.170.14.8 468 0x 800002A 7 0x8467 5
...(output omitted)...
Router Link States (Area 2) 区域 2的 LSA,type 1
Link ID ADV Router Age Seq# Checksum Link count
170.170.9.5 170.170.9.5 1785 0x 800001F 4 0xFBF 2
170.170.15.3 170.170.15.3 719 0x 800001F 5 0x 7F 4D 2
...(output omitted)...
因为路由器 E是 ABR,既有主干域 0,又有 1,2,所有有 3个
type 1的数据库我们看看 170.170.11.6路由器 F产生的 LSA有什么内容
Router_E#show ip ospf database router 170.170.11.6
OSPF Router with ID (170.170.9.5) (Process ID 7)
..(output omitted)...
Router Link States (Area 1)路由器 F有 area 1的接口,所有产生 lsa
Routing Bit Set on this LSA
LS age: 1438
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 170.170.11.6 Advertising Router: 170.170.11.6和 LSID一样,这类 lsa就是这样
LS Seq Number: 8000020D Checksum: 0x3695 Length: 72
Area Border Router路由器 F为 ABR
Number of Links: 4
Link connected to: another Router (point-to-point)连接一个点对点链路
(Link ID) Neighboring Router ID: 170.170.11.7邻居路由器的路由 ID
(Link Data) Router Interface address: 170.170.11.6
Number of TOS metrics: 0
TOS 0 Metrics: 64
Link connected to: a Stub Network在描述一下接口路由
(Link ID) Network/subnet number: 170.170.11.0
(Link Data) Network Mask: 255.255.255.0
Number of TOS metrics: 0
TOS 0 Metrics: 64
Link connected to: another Router (point-to-point) 另一条点对点
(Link ID) Neighboring Router ID: 170.170.14.8
(Link Data) Router Interface address: 170.170.10.6
Number of TOS metrics: 0
TOS 0 Metrics: 64
Link connected to: a Stub Network接口路由
(Link ID) Network/subnet number: 170.170.10.0
(Link Data) Network Mask: 255.255.255.0
Number of TOS metrics: 0
TOS 0 Metrics: 64
路由器 F是点对点类型,下面我们来看看路由器 E的点对点多点类型的 LSA
Router_E#show ip ospf database router 170.170.9.5
...(output omitted)... Router Link States (Area 1)
...(output omitted)...
Link State ID: 170.170.9.5
Advertising Router: 170.170.9.5
Area Border Router
Number of Links: 3
Link connected to: another Router (point-to-point)
(Link ID) Neighboring Router ID: 170.170.14.8(Link Data) Router Interface address: 170.170.9.5 路由器接口地址
Number of TOS metrics: 0
TOS 0 Metrics: 64
...(output omitted)...
Link connected to: a Stub Network描述网络路由(Link ID)
Network/subnet number: 170.170.9.5点对多点产生主机路由
(Link Data) Network Mask: 255.255.255.255
...(rest of output omitted)...
Metrics: 0由于是到自己接口的所以度量为 0
下面看看
Type 2 network link states类型数据
Router_E#show ip ospf database
..(output omitted)...
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
170.170.4.6 170.170.11.6 486 0x800002CF 0xB724
170.170.6.6 170.170.11.6 486 0x 800002A 5 0x 11F 0
...(output omitted)...
上面显示路由器 E有 2条 type 2的 lsa,为什么呢?
因为 type 2只有 DR才产生,LSID为 DR的接口地址,因为本试验只有 2个 Ethernet,所以只有 2个 DR,也就只有 2个 type 2的 lsa。
看看 170.170.6.6有什么信息
Router_E#show ip ospf database network 170.170.6.6
Net Link States (Area 0)
Routing Bit Set on this LSA
LS age: 844
Options: (No TOS-capability, DC)
LS Type: Network Links
Link State ID: 170.170.6.6 (address of Designated Router)
Advertising Router: 170.170.11.6 这个
lsa是路由器 F广播来的
LS Seq Number: 800002A 5
Checksum: 0x 11F 0
Length: 32
Network Mask: /24网络掩码
Attached Router: 170.170.11.6
Attached Router: 170.170.9.5这是连接在这个 ethernet上的 2台路由器 id
下面看看 type 3的 lsa
Router_E#show ip ospf database
...(output omitted)...
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
170.170.2.0 170.170.9.5 719 0x800002AF 0x 355C
170.170.5.0 170.170.9.5 719 0x 800000F 9 0xE952
170.170.5.0 170.170.11.6 1028 0x800002D9 0x1047
170.170.9.5 170.170.9.5 719 0x800002DC 0xD8BF
170.170.9.5 170.170.11.6 1030 0x 800000F 9 0x9564
170.170.9.7 170.170.9.5 722 0x 800000F 9 0x1328
170.170.9.7 170.170.11.6 1030 0x800002D9 0x391D
170.170.9.8 170.170.9.5 722 0x 800000F 9 0x931
170.170.9.8 170.170.11.6 1030 0x800002D9 0x 2F 26
170.170.10.0 170.170.9.5 722 0x 800000F 9 0xD030
170.170.10.0 170.170.11.6 1030 0x800002D9 0x74E7
170.170.11.0 170.170.9.5 722 0x 800000F 9 0xC 53A
170.170.11.0 170.170.11.6 1031 0x800002D9 0x 69F 1
170.170.14.0 170.170.9.5 722 0x 800000F 9 0x 86AC
170.170.14.0 170.170.11.6 1031 0x800002D9 0xACA1
...(output omitted)...
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
170.170.2.0 170.170.9.5 723 0x800002AE 0x375B
170.170.2.0 170.170.11.6 1032 0x 800000F 9 0xF645
170.170.4.0 170.170.9.5 723 0x 800000F 9 0xD 69C
170.170.4.0 170.170.11.6 1032 0x800002DB 0x9402
170.170.6.0 170.170.9.5 723 0x800002E6 0x 7C 10
170.170.6.0 170.170.11.6 1033 0x800002AD 0xDAE7
...(output omitted)...
Summary Net Link States (Area 2)
Link ID ADV Router Age Seq# Checksum
0.0.0 .0 170.170.9.5 724 0x80000275 0x1054
170.170.4.0 170.170.9.5 725 0x 800000F 9 0xF480
170.170.5.0 170.170.9.5 725 0x 800000F 9 0x836
170.170.6.0 170.170.9.5 725 0x 8000012F 0xD 3A
170.170.9.5 170.170.9.5 725 0x8000012D 0x 59F 1
170.170.9.7 170.170.9.5 725 0x 800000F 9 0x 310C
170.170.9.8 170.170.9.5 725 0x 800000F 9 0x2715
170.170.10.0 170.170.9.5 725 0x 800000F 9 0xEE14
170.170.11.0 170.170.9.5 726 0x 800000F 9 0xE31E
170.170.14.0 170.170.9.5 726 0x 800000F 9 0xA490
...(output omitted)...
我们挑一个网段路由看看
Router_E#show ip ospf database summary 170.170.5.0
OSPF Router with ID (170.170.9.5) (Process ID 7)
Summary Net Link States (Area 0)
LS age: 1475
Options: (No TOS-capability, DC)
LS Type: Summary Links(Network)
Link State ID: 170.170.5.0 (summary Network Number)
Advertising Router: 170.170.9.5
这条意思是表示 170.170.95路由器把 5。0/24广播进主干
...(output omitted)...
Link State ID: 170.170.5.0 (summary Network Number)
Advertising Router: 170.170.11.6 这条意思是 11。6也把 5。0广播进主干
..(output omitted)...
Summary Net Link States (Area 2)
LS age: 1477
Options: (No TOS-capability, DC)
LS Type: Summary Links(Network)
Link State ID: 170.170.5.0 (summary Network Number)
Advertising Router: 170.170.9.5 这条意思是 9。5(路由器 E)把 5。0广播进
area 2
下面看看 ASBR type 4类型的 LSA,这个试验路由器 D是 ASBR。
什么是 type 4类型的 lsa呢,就是 abr用来通告到达 ASBR的路由。
Router_E#show ip ospf database
...(output omitted)...
Summary ASB Link States (Area 1)
Link ID
170.170.8.4
ADV Router
170.170.9.5
Age
603
Seq# Checksum
0x8000011D 0x2B1B
170.170.8.4 170.170.11.6 909 0x800002CD 0x4E4D
...(output omitted)...
为什么有 2条到 8.4的路由呢?
因为路由器 E和 F都是 ABR,都要产生到达路由器 D的路由然后向个子的 ared 1
广播,所有有 2条。
LSID是 ASBR的路由器 ID。
Router_E#show ip ospf database ASBR-summary 170.170.8.4
OSPF Router with ID (170.170.9.5) (Process ID 7)
Summary ASB Link States (Area 1)
LS age: 1508
Options: (No TOS-capability, DC)
LS Type: Summary Links(AS Boundary Router)
In the output, look at the lines that say,
Link State ID: 170.170.8.4 (AS Boundary Router address)
Advertising Router: 170.170.9.5
LS Seq Number: 80000120
Checksum: 0x251E
Length: 28
Network Mask: /0
TOS: 0 Metric: 20
Adv Router is not-reachable
LS age: 12
Options: (No TOS-capability, DC)
LS Type: Summary Links(AS Boundary Router)
Link State ID: 170.170.8.4 (AS Boundary Router address)
Advertising Router: 170.170.11.6
...(rest of output omitted)...
最后在看看外部链路类型,external link 本试验路由器 D的 170.170.3.0/24 没有广播进 ospf,使用 redistributing connected重分布进 ospf,所有是外部路由,我们检查一下。
Router_E#show ip ospf database
...(output omitted)...
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
170.170.3.0 170.170.8.4 1973 0x 8000028A 0x5DFD 0
170.170.4.0 170.170.8.4 1973 0x 8000028A 0x5208 0
...(output omitted)...
看到广播路由器的 ID是 8.4是 D,网段是 3.0和 4.0正好是 D的直连网段。
Router_E#show ip ospf database external 170.170.3.0
OSPF Router with ID (170.170.9.5) (Process ID 7)
Type-5 AS External Link States
Routing Bit Set on this LSA
LS age: 717
Options: (No TOS-capability, DC)
LS Type: AS External Link
Link State ID: 170.170.3.0 (External Network Number )
Advertising Router: 170.170.8.4
LS Seq Number: 8000028B
Checksum: 0x5BFE
Length: 36
Network Mask: /24
Metric Type: 2 (Larger than any link state path)
TOS: 0
Metric: 20
Forward Address: 0.0.0 .0 type 5路由的转发地址不改变,仍然是广播此路由的路由的地址,所有要有 type 4类型配合才能发布进边缘域。
External Route Tag: 0
本次试验完毕,怎么样,这一节够无聊吧,不过我倒觉得挺有意思,要有乐观的生活态度,
呵呵继续。
Lab 7:配置虚链路
试验目的:
这个试验很简单,就是配置虚链路并校验状态。
试验思路:
area 51 和主干不直连,要配置一条虚链路通过 C连到主干域。
配置过程:
你想到要从那个路由配置虚链路了吗?应该从路由器 C上和 E上配置,路由器 C的 s1端口属于 area 51,s0端口属于 area 0
我们先查一下路由器 B的路由表
Router_B#show 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, P -periodicdownloaded static
route
T - traffic engineered route
Gateway of last resort is not set
170.170.0.0/24 is subnetted, 3 subnets
C 170.170.1.0 is directly connected, Serial0
O 170.170.13.0 [110/128] via 170.170.1.1, Serial0
C 170.170.17.0 is directly connected, Ethernet0
Router_B#
因为路由器 B没有和主干相连,所以主干发过来的路由收不到,只有域内路由。再看看 database
Router_B#show ip ospf database
OSPF Router with ID (170.170.17.2) (Process ID 7)
Router Link States (Area 51)
Link ID ADV Router Age Seq# Checksum Link count
170.170.13.1 170.170.13.1 88 0x80000004 0x8E 6A 4
170.170.15.3 170.170.15.3 248 0x80000006 0xB7ED 2
170.170.17.2 170.170.17.2 70 0x80000099 0xD454 2
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
170.170.3.0 170.170.8.4 625 0x80000097 0x4907 0
170.170.4.0 170.170.8.4 625 0x80000097 0x3E11 0
Router_B#
路由器 B有 2条外部路由,可为什么没有加入到路由表中呢,因为没有一条 type4的路由,也就是说没有到达 ASBR的路由。
配置 C到 E的虚链路
Router_C(config)#router ospf 7
Router_C(config-router)#area 2 virtual-link 170.170.9.5
Router_C(config-router)#end
Router_C#
Router_E#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router_E(config)#router ospf 7
Router_E(config-router)#area 2 virtual-link 170.170.15.3
Router_E(config-router)#end
Router_E#
在查查路由器 B的路由表
Router_B#show 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, P -periodicdownloaded static
route
T - traffic engineered route
Gateway of last resort is not set
170.170.0.0/16 is variably subnetted, 14 subnets, 2 masks
O IA 170.170.9.8/32 [110/256] via 170.170.1.1, Serial0
C 170.170.1.0/24 is directly connected, Serial0
O IA 170.170.2.0/24 [110/192] via 170.170.1.1, Serial0
O E2 170.170.3.0/24 [110/20] via 170.170.1.1, Serial0
O IA 170.170.4.0/24 [110/212] via 170.170.1.1, Serial0
O IA 170.170.5.0/24 [110/266] via 170.170.1.1, Serial0
O IA 170.170.6.0/24 [110/202] via 170.170.1.1, Serial0
O IA 170.170.10.0/24 [110/266] via 170.170.1.1, Serial0
...(rest of output omitted)...
Router_C#show ip ospf database
OSPF Router with ID (170.170.15.3) (Process ID 7)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
170.170.8.4 170.170.8.4 232 (DNA) 0x80000246 0x 550C 1
170.170.9.5 170.170.9.5 6 (DNA) 0x 8000028F 0x255 2
170.170.11.6 170.170.11.6 1597 (DNA) 0x80000289 0x6EC8 2
170.170.15.3 170.170.15.3 376 0x80000003 0x5909 1
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
170.170.4.6 170.170.11.6 1597 (DNA) 0x80000288 0x46DC
170.170.6.6 170.170.11.6 1597 (DNA) 0x80000288 0x4BD3
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
170.170.1.0 170.170.15.3 385 0x80000001 0x 8F 6
170.170.2.0 170.170.9.5 1665 (DNA) 0x80000288 0x8335
170.170.2.0 170.170.15.3 385 0x80000001 0x 7AC 3
DNA是 do not age的意思,虚链路和 demand circuit这样表示。
在路由器 C上检查自己生成的 type 1 database状态。
Router_C# show ip ospf data router 170.170.15.3
OSPF Router with ID (170.170.15.3) (Process ID 7)
Router Link States (Area 0)
LS age: 1141
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 170.170.15.3
Advertising Router: 170.170.15.3
LS Seq Number: 800001E1
Checksum: 0x98E9
Length: 36
Area Border Router
Number of Links: 1
Link connected to: a Virtual Link
(Link ID) Neighboring Router ID: 170.170.9.5
(Link Data) Router Interface address: 170.170.2.3
Number of TOS metrics: 0
TOS 0 Metrics: 64
...(rest of output omitted)
本次试验完毕
Lab 8:重分布 Rip 进 OSPF
试验目的:
导入 Rip路由到 ospf域
试验思路:
路由器 C是一台 ASBR,运行 ospf和 rip,s1和 e0端口运行 rip,s0端口在
area 2运行 ospf 路由器 C能学到 A的 150.150.0.0/16路由,以便用外部路由形式发OSPF。
配置过程:
先看看路由器 c的路由表
Router_C#show 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
Gateway of last resort is not set
R 150.150.0.0/16 [120/1] via 170.170.13.1, 00:00:08, Serial1
170.170.0.0/16 is variably subnetted, 12 subnets, 2 masks
O IA 170.170.9.8/32 [110/128] via 170.170.2.5, 00:45:28, Serial0
C 170.170.2.0/24 is directly connected, Serial0
O IA 170.170.4.0/24 [110/84] via 170.170.2.5, 3d00h, Serial0
O IA 170.170.5.0/24 [110/138] via 170.170.2.5, 3d00h, Serial0
O IA 170.170.6.0/24 [110/74] via 170.170.2.5, 3d00h, Serial0
O IA 170.170.10.0/24 [110/192] via 170.170.2.5, 00:45:23, Serial0
O IA 170.170.11.0/24 [110/192] via 170.170.2.5, 3d00h, Serial0
O IA 170.170.9.5/32 [110/64] via 170.170.2.5, 3d00h, Serial0
C 170.170.13.0/24 is directly connected, Serial1
O IA 170.170.14.0/24 [110/138] via 170.170.2.5, 00:45:28, Serial0
O IA 170.170.9.7/32 [110/128] via 170.170.2.5, 3d00h, Serial0
C 170.170.15.0/24 is directly connected, Ethernet0
Router_C#
还记得 rip是有类路由吧,所以掩码是 16位。
把 rip发进 ospf:
Router_C(config)#router ospf 7
Router_C(config-router)#redistribute rip subnets
Router_C(config-router)#exit
Router_C(config)#
外部路由度量有 external Type 2 or external Type 1. 缺省是 external Type 2.
我们在路由器 D上检查一下路由表:
Router_D#show 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, P -periodicdownloaded static
route
T - traffic engineered route
Gateway of last resort is not set
170.170.0.0/16 is variably subnetted, 13 subnets, 2 masks
O IA 170.170.9.8/32 [110/74] via 170.170.4.6, Ethernet1
O IA 170.170.2.0/24 [110/84] via 170.170.4.6, Ethernet1
C 170.170.3.0/24 is directly connected, Ethernet0
C 170.170.4.0/24 is directly connected, Ethernet1
O IA 170.170.5.0/24 [110/84] via 170.170.4.6, Ethernet1
O 170.170.6.0/24 [110/20] via 170.170.4.6, Ethernet1
O IA 170.170.10.0/24 [110/74] via 170.170.4.6, Ethernet1
O IA 170.170.11.0/24 [110/74] via 170.170.4.6, Ethernet1
O IA 170.170.9.5/32 [110/20] via 170.170.4.6, Ethernet1
O E2 170.170.13.0/24 [110/20] via 170.170.4.6, Ethernet1
O IA 170.170.14.0/24 [110/84] via 170.170.4.6, Ethernet1
O IA 170.170.9.7/32 [110/74] via 170.170.4.6, Ethernet1
O E2 170.170.15.0/24 [110/20] via 170.170.4.6, Ethernet1
O E2 150.150.0.0/16 [110/20] via 170.170.4.6, Ethernet1
Router_D#
可以看到外部路由,类型为 E2
本次试验完毕。
全部试验完毕。
如果大家能耐着性子仔细看完的话,我想这些内容应该对你有所帮助,那些没有路由器的朋
友,看完这些东西,也应该对那些讨厌的 LSA类型不再抽象。
如果你感觉这些文章对你有帮助,那就是我莫大的荣幸!
谢谢