路由策略及重发步的综合实验来啦!详细

5 篇文章 0 订阅

image-20220726155138447

第一步,配置各路由器的接口地址和环回接口地址

[R1-GigabitEthernet0/0/0]ip address 12.1.1.1 24
[R1-GigabitEthernet0/0/1]ip address 13.1.1.1 24
[R1-LoopBack0]ip address 1.1.1.1 24
[R1-LoopBack1]ip address 172.16.1.1 24
[R1-LoopBack2]ip address 172.16.2.1 24
[R1-LoopBack3]ip address 172.16.3.1 24
[R1-LoopBack4]ip address 172.16.4.1 24

[R2-GigabitEthernet0/0/0]ip address 12.1.1.2 24
[R2-GigabitEthernet0/0/1]ip address 24.1.1.2 24
[R2-LoopBack0]ip address 2.2.2.2 24

[R3-GigabitEthernet0/0/0]ip address 13.1.1.3 24
[R3-GigabitEthernet0/0/1]ip address 34.1.1.3 24
[R3-LoopBack0]ip address 3.3.3.3 24

[R4-GigabitEthernet0/0/0]ip address 24.1.1.4 24
[R4-GigabitEthernet0/0/1]ip address 34.1.1.4 24
[R4-LoopBack0]ip address 4.4.4.4 24

第二步,RIP和OSPF区域宣告

[R1-rip-1]network 12.0.0.0
[R1-rip-1]network 13.0.0.0
[R1-rip-1]network 1.0.0.0
[R1-rip-1]network 172.16.0.0

[R2-rip-1]network 2.0.0.0  
[R2-rip-1]network 12.0.0.0
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 24.1.1.0 0.0.0.255

[R3-rip-1]network 13.0.0.0
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 3.3.3.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]network 34.1.1.0 0.0.0.255

[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]network 24.1.1.0 0.0.0.255
[R4-ospf-1-area-0.0.0.0]network 34.1.1.0 0.0.0.255
[R4-ospf-1-area-0.0.0.0]network 4.4.4.0 0.0.0.255

第三步,重发步

[R2-ospf-1]import-route rip 1
[R2-rip-1]import-route ospf 1

[R3-ospf-1]import-route rip 1
[R3-rip-1]import-route ospf 1

第四步,启动路由策略

[R3]interface LoopBack 0
[R3-LoopBack0]ospf network-type broadcast 

[R2]ip ip-prefix 1 permit 172.16.1.0 24
[R2]ip ip-prefix 2 permit 172.16.2.0 24
[R2]ip ip-prefix 3 permit 172.16.3.0 24
[R2]ip ip-prefix 4 permit 172.16.4.0 24

[R2]route-policy 1 deny node 10
[R2-route-policy]if-match ip-prefix 1

[R2]route-policy 1 permit node 20
[R2-route-policy]if-match ip-prefix 2
[R2-route-policy]apply cost-type type-1

[R2]route-policy 1 permit node 30
[R2-route-policy]if-match ip-prefix 3
[R2-route-policy]apply cost 6

[R2]route-policy 1 permit node 40
[R2-route-policy]if-match ip-prefix 4
[R2-route-policy]apply cost 9
[R2-route-policy]apply cost-type type-1

[R2]route-policy 1 permit node 50

[R2-ospf-1]import-route rip 1 route-policy 1

R3上同理

[R3]ip ip-prefix 1 index 10 permit 172.16.1.0 24
[R3]ip ip-prefix 2 index 10 permit 172.16.2.0 24
[R3]ip ip-prefix 3 index 10 permit 172.16.3.0 24
[R3]ip ip-prefix 4 index 10 permit 172.16.4.0 24
                         
[R3]route-policy 1 deny node 10               
[R3-route-policy] if-match ip-prefix 1

[R3-route-policy]route-policy 1 permit node 20             
[R3-route-policy] if-match ip-prefix 2                     
[R3-route-policy] apply cost-type type-1  

[R3-route-policy]route-policy 1 permit node 30             
[R3-route-policy] if-match ip-prefix 3                     
[R3-route-policy] apply cost 6                                                                   
[R3-route-policy]route-policy 1 permit node 40             
[R3-route-policy] if-match ip-prefix 4                     
[R3-route-policy] apply cost 9                             
[R3-route-policy] apply cost-type type-1

[R3-route-policy]route-policy 1 permit node 50 

[R3-ospf-1]import-route rip 1 route-policy 1
[R2]ip ip-prefix xixi permit 2.2.2.0 24
[R2]route-policy 1 permit node 15
[R2-route-policy]if-match ip-prefix xixi
[R2-route-policy]apply cost-type type-1

[R2]ip ip-prefix 12 permit 12.1.1.0 24
[R2]route-policy 1 permit node 25
[R2-route-policy]if-match ip-prefix 12
[R2-route-policy]apply cost-type type-1

[R3]ip ip-prefix 14 permit 13.1.1.0 24 
[R3]route-policy 1 permit node 15
[R3-route-policy]if-match ip-prefix 14
[R3-route-policy]apply cost-type type-1
[R1]ip ip-prefix 4 permit 3.3.3.0 24
     
[R1]interface g0/0/0
[R1-GigabitEthernet0/0/0]rip metricin ip-prefix 4 2

[R1]ip ip-prefix 24 permit 24.1.1.0 24

[R1]interface g0/0/1
[R1-GigabitEthernet0/0/1]rip metricin ip-prefix 23 2

实验成功!

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Royyic

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值