《ospf学习笔记及配置带拓扑图.doc》由会员分享,可在线阅读,更多相关《ospf学习笔记及配置带拓扑图.doc(17页珍藏版)》请在三一文库上搜索。
1、ospf配置-单区域配置路由器的ID号 route id route-idospf启动后修改route id,需要重新启动ospf协议进入ospf区域试图 area raea-id删除指定的ospf区域 undo area area-id指定网段运行ospf协议 network ip-address wildcard-mask显示ospf概要 display ospf brief显示ospf错误信息 display ospf error显示ospf接口信息 display ospf interface显示邻居信息 display ospf peer显示邻居信息简介 display ospf p
2、eer brief显示ospf路由信息 display ospf routing显示ospf的调试信息 debugging ospf#显示在协议运行过程中发生的各种事件,如接口状态改变,邻居状态改变debugging ospf event显示在协议运行过程中有关的LSA的信息,如本路由生成的LSA,删除的LSAdebugging ospf lsa显示5种收发报文的情况 debugging ospf packet显示用spf算法计算路由的情况debugging ospf spf#ospf配置举例interface ethernet0/0ip address 10.1.1.1 255.255.25
3、5.0interface senai 0/0link-protocol pppip address 20.1.1.1 255.255.255.252ospf eara 1network 10.1.1.0 0.0.0.255network 20.1.1.0 0.0.0.3interface senai 0/0link-protocol pppip address 20.1.1.2 255.255.255.252interface ethernet 0/0ip address 30.1.1.1 255.255.255.0ospf eara 1network 20.1.1.0 0.0.0.3netw
4、ork 30.1.1.0 0.0.0.255#interface serial 1/0ip address 172.16.1.2 255.255.255.0ospfeara 0network 172.16.1.2 255.0.0.0ospf network-type p2mp /将网络的类型修改为point-to-Multpoint#ospf multi-area自治系统 区域 区域idroute id 1.1.1.1interface lookback 0ip add 1.1.1.1 255.255.255.252interface s0/0link-protocol pppip addre
5、ss 20.1.1.1 255.255.255.252interface ethernet0/0ip address 10.1.1.1 255.255.255.0ospf area 0network 10.1.1.0 0.0.0.255network 20.1.1.0 0.0.0.3network 1.1.1.0 0.0.0.3route id 1.1.1.2 interface lookback 0ip address 1.1.1.2 255.255.255.252interface s0/0link-protocol pppip address 20.1.1.1 255.255.255.2
6、52interface s0/1link-protocol pppip address 30.1.1.1 255.255.255.252 ospf area 0network 1.1.1.0 0.0.0.3network 20.1.1.0 0.0.0.3ospf area 1network 30.1.1.0 0.0.0.3route id 1.1.1.3 interface lookback 0ip address 1.1.1.3 255.255.255.252interface s0/0link-protocol pppip address 30.1.1.1 255.255.255.252i
7、nterface ethernet0/0ip address 40.1.1.1 255.255.255.0ospfarea 1network 40.1.1.0 0.0.0.255network 30.1.1.0 0.0.0.3network 1.1.1.0 0.0.0.3#配置ospf区域路由聚合 adr-summary ip-address mask区域路由聚合只能配置在ABR上RTAroute id 1.1.1.1 interface lookback 0ip address 1.1.1.1 255.255.255.255interface e0/0ip address 10.1.1.1
8、255.255.255.0interface s0/0link-protocol pppip address 20.1.1.1 255.255.255.252ospfarea 0network 10.1.1.0 0.0.0.255network 1.1.1.0 0.0.0.0network 20.1.1.0 0.0.0.3route id 1.1.1.2interface lookback 0ip address 1.1.1.2 255.255.255.255interface s0/0link-protocol pppip address 20.1.1.2 255.255.255.252in
9、terface s0/1link-protocol pppip address 30.1.1.1 255.255.255.252ospf area 0network 20.1.1.0 0.0.0.3network 1.1.1.0 0.0.0.0ospf area 1network 30.1.1.0 0.0.0.3abr-summary 40.1.0.0 255.255.0.0 / 配置区域路由聚合route id 1.1.1.3interface lookback 0ip address 1.1.1.3 255.255.255.255interface s0/0link-protocol pp
10、pip sddress 30.1.1.2 255.255.255.252interface e0/0ip address 40.1.1.0 255.255.255.0interface e0/1ip address 40.1.2.0 255.255.255.0ospf area 1network 40.1.2.0 0.0.0.255network 40.1.1.0 0.0.0.255network 30.1.1.0 0.0.0.255network 1.1.1.0 0.0.0.0#配置ospf引入路由聚合命令undoimport-route protocol配置ospf引入外部路由的最小时间间
11、隔 default interval seconds恢复引入外部路由最小时间间隔的缺省值 undo default interval配置ospf每次引入路由的数量上限 default limit routes恢复每次引入外部路由的数量上限 undo default limit恢复)配置ospf在接收外部路由时缺省的花费值 undodefault cost value配置ospf路由集合 asbr-summary ip-address mask注意:区域路由聚合 与 引入路由聚合 是不同的概念route id 1.1.1.1interface lookback 0ip address 1.1.1
12、.1 255.255.255.255interface e0/0ip address 10.1.1.1 255.255.255.0interface s0/0link-protocol pppip address 20.1.1.1 255.255.255.252ospfarea 0network 1.1.1.0 0.0.0.0network 10.1.1.0 0.0.0.3network 20.1.1.0 0.0.0.3route id 1.1.1.2interface lookback 0ip address 1.1.1.2 255.255.255.255interface s0/0link
13、-protocol pppip address 20.1.1.2 255.255.255.252interface s0/0link-protocol pppip address 30.1.1.1 255.255.255.252ospfarea 0network 20.1.1.0 0.0.0.3network 1.1.1.0 0.0.0.0ospf area 1network 30.1.1.0 0.0.0.3route id 1.1.1.3interface lookback 0ip address 1.1.1.3 255.255.255.255interface s0/0link-proto
14、col pppip address 30.1.1.2 255.255.255.252interface e0/0ip address 40.1.1.0 255.255.255.0interface e/1ip address 40.1.1.2.0 255.255.255.0import-route direct /配置引入路由命令asbr-summmary 40.1.0.0 255.255.0.0 / 配置路由汇聚ospf area 1network 1.1.1.0 0.0.0.0network 30.1.1.0 0.0.0.3对进行引入路由汇聚的网段不用network发布#stub 区域配置
15、命令route id 1.1.1.1interface lookback 0ip address 1.1.1.1 255.255.255.255interface e0/0ip address 10.1.1.1 255.255.255.0interface s0/0link-protocol pppip address 20.1.1.1 255.255.255.255import static /引入静态路由ospf area 0network 1.1.1.0 0.0.0.0network 10.1.1.0 0.0.0.255network 20.1.1.0 0.0.0.3ip-route s
16、tatic 100.1.1.0 255.255.255.0route id 1.1.1.2interface lookback 0ip address 1.1.1.2 255.255.255.255interface s0/0link-protocol pppip address 20.1.1.2 255.255.255.252interface s0/1link-protocol pppip address 30.1.1.1 255.255.255.252ospf area 0network 20.1.1.0 0.0.0.3ospf area 1stub /配置stubnetwork 30.
17、1.1.0 0.0.0.3route id 1.1.1.3interface lookback 0ip address 1.1.1.3 255.255.255.255interface s0/0link-protocol pppip address 30.1.1.2 255.255.255.252interface e0/1ip address 40.1.2.0 255.255.255.0interface e0/0 ip address 40.1.1.0 255.255.255.0ospf area 1stubnetwork 40.1.1.0 0.0.0.255network 40.1.2.
18、0 0.0.0.255network 30.1.1.0 0.0.0.3network 1.1.1.0 0.0.0.0注意:对配置好的stub区域时要发布该区域的所有网段#完全stub区域配置举例配置Total stub 和 stub 相比只需要在ABR上配置stub no-summaryroute id 1.1.1.1interface lookback 0ip address 1.1.1.1 255.255.255.255interface s0/0link-protocol pppip address 20.1.1.1 255.255.255.252interface e0/0ip add
19、ress 10.1.1.1 255.255.255.0import staticospfarea 0network 20.1.1.0 0.0.0.3network 10.1.1.0 0.0.0.255network 1.1.1.0 0.0.0.0ip route-static 100.1.1.0 50.1.1.2route ip 1.1.1.2interface lookback 0ip address 1.1.1.0 255.255.255.255interface s0/0link-protocol pppip address 20.1.1.2 255.255.255.252interfa
20、ce s0/1link-protocol pppip address 30.1.1.1.1 255.255.255.252ospf area 0network 20.1.1.2 0.0.0.3network 1.1.1.0 0.0.0.0ospf area 1stub /配置Total stubstub no-summary /network 30.1.1.1 0.0.0.3route id 1.1.1.3interface lookback 0ip address 1.1.1.3 255.255.255.255interface s0/0link-protocol pppip address
21、 30.1.1.2 255.255.255.252interface e0/0ip address 40.1.1.0 255.255.255.0interface e0/1ip address 40.1.2.0 255.255.255.0ospfarea 0stubnetwork 40.1.1.0 0.0.0.255network 40.1.2.0 0.0.0.255network 1.1.1.0 0.0.0.0network 30.1.1.0 0.0.0.3#ospf的NSSA区域配置命令(Not-So-Stubby-Area)这种区域能够以受限的方式引入AS外部路由route id 1.1
22、.1.1 interface lookback 0ip address 1.1.1.1 255.255.255.255interface ethernet0/0ip address 10.1.1.1 255.255.255.0interface s0/0link-protocol pppip address 20.1.1.1 255.255.255.252ospf area 0network 20.1.1.0 0.0.0.3network 10.1.1.0 0.0.0.255network 1.1.1.1 0.0.0.0route id 1.1.1.2interface lookback 0i
23、p address 1.1.1.2 255.255.255.255interface s0/0link-protocol pppip address 20.1.1.2 255.255.255.252interface s0/1link-protocol pppip address 30.1.1.1 255.255.255.252ospf area 0network 20.1.1.0 0.0.0.3network 1.1.1.0 0.0.0.0ospf area 1nssa default-route-advertise /在area 1区域内通告默认路由,配置NSSAnetwork 30.1.
24、1.0 0.0.0.3route id 1.1.13interface lookback 0ip address 1.1.1.3 255.255.255.255interface s0/0link-protocol pppip address 30.1.1.2 255.255.255.252interface s0/1link-protocol pppip address 50.1.1.2 255.255.255.252interface e0/1ip address 40.1.2.0 255.255.255.0interface e0/0ip address 40.1.1.0 255.255
25、.255.0import static / 引入外部静态路由ospf area 1nssa /开启nssanetwork 40.1.1.0 0.0.0.255network 40.1.2.0 0.0.0.255network 30.1.1.0 0.0.0.3ip route-static 100.1.1.0 24 50.1.1.2network 1.1.1.0 0.0.0.0networ 50.1.1.0 0.0.0.3#ospf Total NSSAroute id 1.1.1.1interface lookback 0ip address 1.1.1.1 255.255.255.255in
26、terface ethernet0/0ip address 10.1.1.1 255.255.255.0interface s0/0link-protocol pppip address 20.1.1.1 255.255.255.252ospf area 0network 10.1.1.0 0.0.0.255network 20.1.1.0 0.0.0.3network 1.1.1.0 0.0.0.0route id 1.1.1.2interface lookback 0ip address 1.1.1.2 255.255.255.255interface s0/0link-protocol
27、pppip address 20.1.1.2 255.255.255.252intrface s0/1link-protocol pppip address 30.1.1.1 255.255.255.252ospfarea 0network 20.1.1.0 0.0.0.3ospf area 1nssa defalut-route-advertise no-summary / 配置Total NSSAnetwork 30.1.1.0 0.0.0.3network 1.1.1.0 0.0.0.0route id 1.1.1.3interface lookback 0ip address 1.1.
28、1.3 255.255.255.255interface s0/0link-protocol pppip address 30.1.1.2 255.255.255.255interface s0/1link-protocol pppip address 50.1.1.2 255.255.255.252interface ethernet0/1ip address 40.1.2.0 255.255.255.0interface ethernet0/0ip address 40.1.1.0 255.255.255.0import staticospf area 1nssaip route-static 100.1.1.0 24 50.1.1.2network 40.1.1.0 0.0.0.255network 40.1.2.0 0.0.0.255network 50.1.1.0 0.0.0.3network 30.1.1.0 0.0.0.3network 1.1.1.0 0.0.0.0