资源描述
ospf配置-单区域
配置路由器的ID号 route id route-id
ospf启动后修改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 peer brief
显示ospf路由信息 display ospf routing
显示ospf的调试信息 debugging ospf
#################################################################
显示在协议运行过程中发生的各种事件,如接口状态改变,邻居状态改变
debugging ospf event
显示在协议运行过程中有关的LSA的信息,如本路由生成的LSA,删除的LSA
debugging ospf lsa
显示5种收发报文的情况
debugging ospf packet
显示用spf算法计算路由的情况
debugging ospf spf
#################################################################
ospf配置举例
interface ethernet0/0
ip address 10.1.1.1 255.255.255.0
interface senai 0/0
link-protocol ppp
ip address 20.1.1.1 255.255.255.252
ospf eara 1
network 10.1.1.0 0.0.0.255
network 20.1.1.0 0.0.0.3
interface senai 0/0
link-protocol ppp
ip address 20.1.1.2 255.255.255.252
interface ethernet 0/0
ip address 30.1.1.1 255.255.255.0
ospf eara 1
network 20.1.1.0 0.0.0.3
network 30.1.1.0 0.0.0.255
#################################################################
interface serial 1/0
ip address 172.16.1.2 255.255.255.0
ospf
eara 0
network 172.16.1.2 255.0.0.0
ospf network-type p2mp //将网络的类型修改为point-to-Multpoint
#################################################################
ospf multi-area
自治系统 区域 区域id
route id 1.1.1.1
interface lookback 0
ip add 1.1.1.1 255.255.255.252
interface s0/0
link-protocol ppp
ip address 20.1.1.1 255.255.255.252
interface ethernet0/0
ip address 10.1.1.1 255.255.255.0
ospf
area 0
network 10.1.1.0 0.0.0.255
network 20.1.1.0 0.0.0.3
network 1.1.1.0 0.0.0.3
route id 1.1.1.2
interface lookback 0
ip address 1.1.1.2 255.255.255.252
interface s0/0
link-protocol ppp
ip address 20.1.1.1 255.255.255.252
interface s0/1
link-protocol ppp
ip address 30.1.1.1 255.255.255.252
ospf
area 0
network 1.1.1.0 0.0.0.3
network 20.1.1.0 0.0.0.3
ospf
area 1
network 30.1.1.0 0.0.0.3
route id 1.1.1.3
interface lookback 0
ip address 1.1.1.3 255.255.255.252
interface s0/0
link-protocol ppp
ip address 30.1.1.1 255.255.255.252
interface ethernet0/0
ip address 40.1.1.1 255.255.255.0
ospf
area 1
network 40.1.1.0 0.0.0.255
network 30.1.1.0 0.0.0.3
network 1.1.1.0 0.0.0.3
#################################################################
配置ospf区域路由聚合 adr-summary ip-address mask
区域路由聚合只能配置在ABR上
RTA
route id 1.1.1.1
interface lookback 0
ip address 1.1.1.1 255.255.255.255
interface e0/0
ip address 10.1.1.1 255.255.255.0
interface s0/0
link-protocol ppp
ip address 20.1.1.1 255.255.255.252
ospf
area 0
network 10.1.1.0 0.0.0.255
network 1.1.1.0 0.0.0.0
network 20.1.1.0 0.0.0.3
route id 1.1.1.2
interface lookback 0
ip address 1.1.1.2 255.255.255.255
interface s0/0
link-protocol ppp
ip address 20.1.1.2 255.255.255.252
interface s0/1
link-protocol ppp
ip address 30.1.1.1 255.255.255.252
ospf
area 0
network 20.1.1.0 0.0.0.3
network 1.1.1.0 0.0.0.0
ospf
area 1
network 30.1.1.0 0.0.0.3
abr-summary 40.1.0.0 255.255.0.0 // 配置区域路由聚合
route id 1.1.1.3
interface lookback 0
ip address 1.1.1.3 255.255.255.255
interface s0/0
link-protocol ppp
ip sddress 30.1.1.2 255.255.255.252
interface e0/0
ip address 40.1.1.0 255.255.255.0
interface e0/1
ip address 40.1.2.0 255.255.255.0
ospf
area 1
network 40.1.2.0 0.0.0.255
network 40.1.1.0 0.0.0.255
network 30.1.1.0 0.0.0.255
network 1.1.1.0 0.0.0.0
#################################################################
配置ospf引入路由聚合命令
[undo]import-route protocol
配置ospf引入外部路由的最小时间间隔 default interval seconds
恢复引入外部路由最小时间间隔的缺省值 undo default interval
配置ospf每次引入路由的数量上限 default limit routes
恢复每次引入外部路由的数量上限 undo default limit
恢复)配置ospf在接收外部路由时缺省的花费值 [undo]default cost value
配置ospf路由集合 asbr-summary ip-address mask
注意:区域路由聚合 与 引入路由聚合 是不同的概念
route id 1.1.1.1
interface lookback 0
ip address 1.1.1.1 255.255.255.255
interface e0/0
ip address 10.1.1.1 255.255.255.0
interface s0/0
link-protocol ppp
ip address 20.1.1.1 255.255.255.252
ospf
area 0
network 1.1.1.0 0.0.0.0
network 10.1.1.0 0.0.0.3
network 20.1.1.0 0.0.0.3
route id 1.1.1.2
interface lookback 0
ip address 1.1.1.2 255.255.255.255
interface s0/0
link-protocol ppp
ip address 20.1.1.2 255.255.255.252
interface s0/0
link-protocol ppp
ip address 30.1.1.1 255.255.255.252
ospf
area 0
network 20.1.1.0 0.0.0.3
network 1.1.1.0 0.0.0.0
ospf
area 1
network 30.1.1.0 0.0.0.3
route id 1.1.1.3
interface lookback 0
ip address 1.1.1.3 255.255.255.255
interface s0/0
link-protocol ppp
ip address 30.1.1.2 255.255.255.252
interface e0/0
ip address 40.1.1.0 255.255.255.0
interface e/1
ip address 40.1.1.2.0 255.255.255.0
import-route direct //配置引入路由命令
asbr-summmary 40.1.0.0 255.255.0.0 // 配置路由汇聚
ospf
area 1
network 1.1.1.0 0.0.0.0
network 30.1.1.0 0.0.0.3
对进行引入路由汇聚的网段不用network发布
#################################################################
stub 区域配置命令
route id 1.1.1.1
interface lookback 0
ip address 1.1.1.1 255.255.255.255
interface e0/0
ip address 10.1.1.1 255.255.255.0
interface s0/0
link-protocol ppp
ip address 20..1.1.1 255.255.255.255
import static //引入静态路由
ospf area 0
network 1.1.1.0 0.0.0.0
network 10.1.1.0 0.0.0.255
network 20.1.1.0 0.0.0.3
ip-route static 100.1.1.0 255.255.255.0
route id 1.1.1.2
interface lookback 0
ip address 1.1.1.2 255.255.255.255
interface s0/0
link-protocol ppp
ip address 20.1.1.2 255.255.255.252
interface s0/1
link-protocol ppp
ip address 30.1.1.1 255.255.255.252
ospf
area 0
network 20.1.1.0 0.0.0.3
ospf
area 1
stub //配置stub
network 30.1.1.0 0.0.0.3
route id 1.1.1.3
interface lookback 0
ip address 1.1.1.3 255.255.255.255
interface s0/0
link-protocol ppp
ip address 30.1.1.2 255.255.255.252
interface e0/1
ip address 40.1.2.0 255.255.255.0
interface e0/0
ip address 40.1.1.0 255.255.255.0
ospf
area 1
stub
network 40.1.1.0 0.0.0.255
network 40.1.2.0 0.0.0.255
network 30.1.1.0 0.0.0.3
network 1.1.1.0 0.0.0.0
注意:对配置好的stub区域时要发布该区域的所有网段
#################################################################
完全stub区域配置举例
配置Total stub 和 stub 相比只需要在ABR上配置stub no-summary
route id 1.1.1.1
interface lookback 0
ip address 1.1.1.1 255.255.255.255
interface s0/0
link-protocol ppp
ip address 20.1.1.1 255.255.255.252
interface e0/0
ip address 10.1.1.1 255.255.255.0
import static
ospf
area 0
network 20.1.1.0 0.0.0.3
network 10.1.1.0 0.0.0.255
network 1.1.1.0 0.0.0.0
ip route-static 100.1.1.0 50.1.1.2
route ip 1.1.1.2
interface lookback 0
ip address 1.1.1.0 255.255.255.255
interface s0/0
link-protocol ppp
ip address 20.1.1.2 255.255.255.252
interface s0/1
link-protocol ppp
ip address 30.1.1.1.1 255.255.255.252
ospf
area 0
network 20.1.1.2 0.0.0.3
network 1.1.1.0 0.0.0.0
ospf
area 1
stub //配置Total stub
stub no-summary //
network 30.1.1.1 0.0.0.3
route id 1.1.1.3
interface lookback 0
ip address 1.1.1.3 255.255.255.255
interface s0/0
link-protocol ppp
ip address 30.1.1.2 255.255.255.252
interface e0/0
ip address 40.1.1.0 255.255.255.0
interface e0/1
ip address 40.1.2.0 255.255.255.0
ospf
area 0
stub
network 40.1.1.0 0.0.0.255
network 40.1.2.0 0.0.0.255
network 1.1.1.0 0.0.0.0
network 30.1.1.0 0.0.0.3
#################################################################
ospf的NSSA区域配置命令(Not-So-Stubby-Area)
这种区域能够以受限的方式引入AS外部路由
route id 1.1.1.1
interface lookback 0
ip address 1.1.1.1 255.255.255.255
interface ethernet0/0
ip address 10.1.1.1 255.255.255.0
interface s0/0
link-protocol ppp
ip address 20.1.1.1 255.255.255.252
ospf
area 0
network 20.1.1.0 0.0.0.3
network 10.1.1.0 0.0.0.255
network 1.1.1.1 0.0.0.0
route id 1.1.1.2
interface lookback 0
ip address 1.1.1.2 255.255.255.255
interface s0/0
link-protocol ppp
ip address 20.1.1.2 255.255.255.252
interface s0/1
link-protocol ppp
ip address 30.1.1.1 255.255.255.252
ospf
area 0
network 20.1.1.0 0.0.0.3
network 1.1.1.0 0.0.0.0
ospf
area 1
nssa default-route-advertise //在area 1区域内通告默认路由,配置NSSA
network 30.1.1.0 0.0.0.3
route id 1.1.13
interface lookback 0
ip address 1.1.1.3 255.255.255.255
interface s0/0
link-protocol ppp
ip address 30.1.1.2 255.255.255.252
interface s0/1
link-protocol ppp
ip address 50.1.1.2 255.255.255.252
interface e0/1
ip address 40.1.2.0 255.255.255.0
interface e0/0
ip address 40.1.1.0 255.255.255.0
import static // 引入外部静态路由
ospf
area 1
nssa //开启nssa
network 40.1.1.0 0.0.0.255
network 40.1.2.0 0.0.0.255
network 30.1.1.0 0.0.0.3
ip route-static 100.1.1.0 24 50.1.1.2
network 1.1.1.0 0.0.0.0
networ 50.1.1.0 0.0.0.3
#################################################################
ospf Total NSSA
route id 1.1.1.1
interface lookback 0
ip address 1.1.1.1 255.255.255.255
interface ethernet0/0
ip address 10.1.1.1 255.255.255.0
interface s0/0
link-protocol ppp
ip address 20.1.1.1 255.255.255.252
ospf
area 0
network 10.1.1.0 0.0.0.255
network 20.1.1.0 0.0.0.3
network 1.1.1.0 0.0.0.0
route id 1.1.1.2
interface lookback 0
ip address 1.1.1.2 255.255.255.255
interface s0/0
link-protocol ppp
ip address 20.1.1.2 255.255.255.252
intrface s0/1
link-protocol ppp
ip address 30.1.1.1 255.255.255.252
ospf
area 0
network 20.1.1.0 0.0.0.3
ospf
area 1
nssa defalut-route-advertise no-summary // 配置Total NSSA
network 30.1.1.0 0.0.0.3
network 1.1.1.0 0.0.0.0
route id 1.1.1.3
interface lookback 0
ip address 1.1.1.3 255.255.255.255
interface s0/0
link-protocol ppp
ip address 30.1.1.2 255.255.255.255
interface s0/1
link-protocol ppp
ip address 50.1.1.2 255.255.255.252
interface ethernet0/1
ip address 40.1.2.0 255.255.255.0
interface ethernet0/0
ip address 40.1.1.0 255.255.255.0
import static
ospf
area 1
nssa
ip route-static 100.1.1.0 24 50.1.1.2
network 40.1.1.0 0.0.0.255
network 40.1.2.0 0.0.0.255
network 50.1.1.0 0.0.0.3
network 30.1.1.0 0.0.0.3
network 1.1.1.0 0.0.0.0
展开阅读全文