OSPF stub实验

在这里插入图片描述末节区域作用:减少数据库的大小,从而保证网络的稳定性

需求1:希望数据库不要有 13和23 —— 精确引入
需求2:配置特殊区域,对端相连的路由器也要配置的
需求3:三类的明细路由条目也不要有,totally stub
需求4:主备链路,优先走自己的区域

1、基本配置

1、基本配置
R1:
sys
sysname R1
int loop 0
ip add 1.1.1.1 32
int e0/0/1
ip add 10.0.14.1 24
int e0/0/0
ip add 10.0.15.1 24
int g0/0/1
ip add 10.0.12.1 24
int g0/0/0
ip add 10.0.13.1 24
q

R2:
sys
sysname R2
int loop 0
ip add 2.2.2.2 32
int e0/0/1
ip add 10.0.25.2 24
int e0/0/0
ip add 10.0.24.2 24
int g0/0/1
ip add 10.0.12.2 24
int g0/0/0
ip add 10.0.23.2 24
q

R3:
sys
sysname R3
int loop 0
ip add 3.3.3.3 32
int loop 1
ip add 20.0.0.1 24
int g0/0/0
ip add 10.0.13.3 24
int g0/0/1
ip add 10.0.23.3 24
q

R4:
sys
sysname R4
int loop 0
ip add 4.4.4.4 32
int e0/0/1
ip add 10.0.14.4 24
int e0/0/0
ip add 10.0.24.4 24
q

R5:
sys
sysname R5
int loop 0
ip add 5.5.5.5 32
int e0/0/1
ip add 10.0.25.5 24
int e0/0/0
ip add 10.0.15.5 24
q

 
2.配置OSPF协议

2.配置OSPF协议
R1:
ospf 1 router-id 1.1.1.1
 area 0.0.0.0
  network 10.0.13.1 0.0.0.0
  network 10.0.12.1 0.0.0.0
  network 1.1.1.1 0.0.0.0
 area 0.0.0.1
  network 10.0.14.1 0.0.0.0
 area 0.0.0.2
  network 10.0.15.1 0.0.0.0

R2:
ospf 1 router-id 2.2.2.2
 area 0.0.0.0
  network 10.0.23.2 0.0.0.0
  network 10.0.12.2 0.0.0.0
  network 2.2.2.2 0.0.0.0
 area 0.0.0.1
  network 10.0.24.2 0.0.0.0
 area 0.0.0.2
  network 10.0.25.2 0.0.0.0

R3:
ospf 1 router-id 3.3.3.3
 area 0.0.0.0
  network 3.3.3.3 0.0.0.0
  network 20.0.0.1 0.0.0.0
  network 10.0.13.3 0.0.0.0
  network 10.0.23.3 0.0.0.0

R4:
ospf 1 router-id 4.4.4.4
 area 0.0.0.1
  network 10.0.14.4 0.0.0.0
  network 10.0.24.4 0.0.0.0
  network 4.4.4.4 0.0.0.0

R5:
ospf 1 router-id 5.5.5.5
 area 0.0.0.2
  network 10.0.25.5 0.0.0.0
  network 5.5.5.5 0.0.0.0
  network 10.0.15.5 0.0.0.0

R3:引入外部路由
[R3-ospf-1]import-route direct

补充:二类不能精确反应路径,一类才能反应真实路径
dis ospf lsdb 可以发现 引入外部路由 默认参数:cost 1、type 2、tag 1
 Routing for ASEs
 Destination        Cost      Type       Tag         NextHop         AdvRouter
 20.0.0.0/24        1         Type2      1           10.0.14.1       3.3.3.3
 20.0.0.0/24        1         Type2      1           10.0.24.2       3.3.3.3
 
·import-route direct cost 9  修改cost值
·import-route direct type 1   修改type类型,会覆盖刚才改的cost 9
 外部引入路由的 初始默认值是1,如果修改为type 1,那么R1和R2的cost会变2,1+1
·import-route direct type 1 cost 9  
 Routing for ASEs
 Destination        Cost      Type       Tag         NextHop         AdvRouter
 20.0.0.0/24        11        Type1      1           10.0.14.1       3.3.3.3
 20.0.0.0/24        11        Type1      1           10.0.24.2       3.3.3.3

 
需求1:希望数据库不要有 13和23 —— 做精确引入

需求1:希望数据库不要有 13和23 —— 做精确引入
在R4上dis ospf lsdb,发现有无需要的 13网段和23网段
		 AS External Database
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 External  10.0.13.0       3.3.3.3            964  36    80000001       1
 External  20.0.0.0        3.3.3.3            964  36    80000001       1
 External  10.0.23.0       3.3.3.3            338  36    80000004       1
 External  3.3.3.3         3.3.3.3            964  36    80000001       1
如何减少13和23的数据库条目呢?
 精确引入 —— router policy 
R3:
[R3]acl 2000
[R3-acl-basic-2000]rule permit source 3.3.3.3 0.0.0.255
[R3-acl-basic-2000]rule permit source 20.0.0.0 0.0.0.255
[R3-acl-basic-2000]q
[R3]route-policy 10 permit node 10
Info: New Sequence of this List.
[R3]route-policy 10 permit node 10
[R3-route-policy]if-match acl 2000
[R3-route-policy]q
[R3]ospf
[R3-ospf-1]import-route direct cost 9 type 1 route-policy 10

测试验证:在R4上dis ospf lsdb
		 AS External Database
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 External  20.0.0.0        3.3.3.3            271  36    80000002       9
 External  3.3.3.3         3.3.3.3            271  36    80000002       9
 

回归主题
需求2:配置特殊区域 (对端相连的路由器也要配置的)

需求2:配置特殊区域 (对端相连的路由器也要配置的)
现在要减少 4类和5类 LSA  —— 在R4上dis ospf lsdb
5类LSA是 引入的,不属于任何区域。
R1:
[R1]ospf
[R1-ospf-1]area 1
[R1-ospf-1-area-0.0.0.1]stub
[R1-ospf-1-area-0.0.0.1]area 2
[R1-ospf-1-area-0.0.0.2]stub

R2:
[R2]ospf
[R2-ospf-1]area 1
[R2-ospf-1-area-0.0.0.1]stub
[R2-ospf-1-area-0.0.0.1]area 2
[R2-ospf-1-area-0.0.0.2]stub

R4就配置area 1的 stub ,R5就配置 area 2的  stub
那减少了 4类和5类LSA,它是怎么ping通的。 因为自动会产生指向ABR的缺省路由
[R4]ospf
[R4-ospf-1]area 1
[R4-ospf-1-area-0.0.0.1]stub

[R5]ospf 
[R5-ospf-1]area 2
[R5-ospf-1-area-0.0.0.2]stub

 
需求3:三类的明细路由条目也不要有,totally stub

需求3:三类的明细路由条目也不要有,totally stub
totally stub只需要在ABR上做
[R1-ospf-1]area 1
[R1-ospf-1-area-0.0.0.1]stub no-summary
[R1-ospf-1-area-0.0.0.1]area 2
[R1-ospf-1-area-0.0.0.2]stub no-summary

[R2-ospf-1]area 1
[R2-ospf-1-area-0.0.0.1]stub no-summary
[R2-ospf-1-area-0.0.0.1]area 2
[R2-ospf-1-area-0.0.0.2]stub no-summary

 
需求4:主备链路,优先走自己的区域

需求4:主备链路,优先走自己的区域
现在他路由表中有两条路都可以走
<R4>dis ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 8        Routes : 9        

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        0.0.0.0/0   OSPF    10   2           D   10.0.14.1       Ethernet0/0/1
                    OSPF    10   2           D   10.0.24.2       Ethernet0/0/0

R1主链路下一跳是10.0.14.1,R1down掉了,才往R2走
解决办法:改区域cost值 (也可以接口cost值)
[R1]ospf
[R1-ospf-1]area 2
[R1-ospf-1-area-0.0.0.2]default-cost 9

[R2]ospf
[R2-ospf-1]area 1
[R2-ospf-1-area-0.0.0.1]default-cost 9

测试验证:R4上dis ip routing-table
<R4>dis ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 8        Routes : 8        

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        0.0.0.0/0   OSPF    10   2           D   10.0.14.1       Ethernet0/0/1
      
  • 1
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值