HCIP 重发布实验

在这里插入图片描述

拓扑规划

在这里插入图片描述

ip配置正常配置就行

将R1和R2的环回和R3的34网段宣告到rip协议
R3和R4,R5,R6,R7宣告到ospf里面,7的环回用静态指向ospf就行

宣告协议

R2

ospf 1 router-id 2.2.2.2 
 import-route rip 1
 area 0.0.0.0 
  network 14.1.1.1 0.0.0.0 

rip 1
 version 2
 network 2.0.0.0
 network 12.0.0.0
 import-route ospf 1

R3

ospf 1 router-id 3.3.3.3 
 import-route rip 1
 area 0.0.0.0 
  network 3.3.3.3 0.0.0.0 
  network 34.1.1.1 0.0.0.0 
#

rip 1
 version 2
 network 13.0.0.0
 import-route ospf 1
#

R7
ospf 1 router-id 7.7.7.7 
 import-route direct
 area 0.0.0.0 
  network 67.1.1.2 0.0.0.0 
return
[R7-ospf-1]

解决环路

但是现在就会出现环路,R1访问R7的环回一跳指向R2,R2一跳指向R4,R4下一跳指向R1
R5访问R7的环回下一跳指向R4和R6


但是我们要R3的路由表和之前要一样,可以在R3上面将从rip学习到7环回的路由优先级改为151

[R3]ip ip-prefix b permit 7.7.7.0 24
[R3]route-policy bb permit node 10
Info: New Sequence of this List.
[R3-route-policy]if-match ip-prefix b
[R3-route-policy]apply preference 151

[R3]rip  
[R3-rip-1]preference route-policy bb

这样R3到7的环回走最优路径

        1.1.1.0/24  RIP     100  1           D   13.1.1.1        GigabitEthernet0/0/1
        2.2.2.0/24  RIP     100  2           D   13.1.1.1        GigabitEthernet0/0/1
        3.3.3.3/32  Direct  0    0           D   127.0.0.1       LoopBack0
        4.4.4.4/32  OSPF    10   1           D   34.1.1.2        GigabitEthernet0/0/0
        5.5.5.5/32  OSPF    10   2           D   34.1.1.2        GigabitEthernet0/0/0
        6.6.6.6/32  OSPF    10   3           D   34.1.1.2        GigabitEthernet0/0/0
        7.7.7.0/24  O_ASE   150  1           D   34.1.1.2        GigabitEthernet0/0/0
       12.1.1.0/24  RIP     100  1           D   13.1.1.1        GigabitEthernet0/0/1
       13.1.1.0/24  Direct  0    0           D   13.1.1.2        GigabitEthernet0/0/1
       13.1.1.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/1
     13.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/1
       14.1.1.0/24  RIP     100  2           D   13.1.1.1        GigabitEthernet0/0/1
       34.1.1.0/24  Direct  0    0           D   34.1.1.1        GigabitEthernet0/0/0
       34.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/0
     34.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/0
       45.1.1.0/24  OSPF    10   2           D   34.1.1.2        GigabitEthernet0/0/0
       56.1.1.0/24  OSPF    10   3           D   34.1.1.2        GigabitEthernet0/0/0
       67.1.1.0/24  OSPF    10   4           D   34.1.1.2        GigabitEthernet0/0/0
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

R2
[R2]ip ip-prefix b permit 7.7.7.0 24
[R2]route-policy b permit node 10
Info: New Sequence of this List.
[R2-route-policy]if-match ip-prefix b
[R2-route-policy]apply preference 151
[R2]rip
[R2-rip-1]preference route-policy b

配置好后重启接口R路由表上就只有一条32网段的
[R3]int loop0
[R3-LoopBack0]ip address 3.3.3.3 32

优化路由

2把3环回和34网段到R1上面的开销+1
R2


[R2]ip ip-prefix y permit 3.3.3.3 32
[R2]ip ip-prefix y p
[R2]ip ip-prefix y permit 34.1.1.0 24
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]rip metricout ip-prefix y 2

R3
[R3]ip ip-prefix y p
[R3]ip ip-prefix y permit 24.1.1.0 24
[R3]int g0/0/1
[R3-GigabitEthernet0/0/1]rip metricout ip-prefix y 2


ospf用不了1偏移列表,是rip用的,让2把自己的环回和12网段给4的时候变成类型1

[R2]ip ip-prefix c permit 12.1.1.0 24
[R2]ip ip-prefix c permit 2.2.2.0 24
[R2]route-policy cc permit node 10
Info: New Sequence of this List.
[R2-route-policy]if-match ip-prefix c
[R2-route-policy]apply cost-type type-1
[R2]route-policy cc permit node 20
Info: New Sequence of this List.
[R2]ospf
[R2-ospf-1]import-route rip route-policy cc

R3

[R3]ip ip-prefix c permit 13.1.1.0 24
[R3]route-policy cc permit node 10
Info: New Sequence of this List.
[R3-route-policy]if-match ip-prefix c
[R3-route-policy]apply cost-type type-1 
[R3-route-policy]q
[R3]route-policy cc permit node 20
Info: New Sequence of this List.
[R3]ospf
[R3-ospf-1]import-route rip route-policy cc

路由表

        1.1.1.0/24  Direct  0    0           D   1.1.1.1         LoopBack0
        1.1.1.1/32  Direct  0    0           D   127.0.0.1       LoopBack0
      1.1.1.255/32  Direct  0    0           D   127.0.0.1       LoopBack0
        2.2.2.0/24  RIP     100  1           D   12.1.1.2        GigabitEthernet0/0/1
        3.3.3.3/32  RIP     100  1           D   13.1.1.2        GigabitEthernet0/0/0
        4.4.4.4/32  RIP     100  1           D   12.1.1.2        GigabitEthernet0/0/1
                    RIP     100  1           D   13.1.1.2        GigabitEthernet0/0/0
        5.5.5.5/32  RIP     100  1           D   12.1.1.2        GigabitEthernet0/0/1
                    RIP     100  1           D   13.1.1.2        GigabitEthernet0/0/0
        6.6.6.6/32  RIP     100  1           D   12.1.1.2        GigabitEthernet0/0/1
                    RIP     100  1           D   13.1.1.2        GigabitEthernet0/0/0
        7.7.7.0/24  RIP     100  1           D   12.1.1.2        GigabitEthernet0/0/1
                    RIP     100  1           D   13.1.1.2        GigabitEthernet0/0/0
       12.1.1.0/24  Direct  0    0           D   12.1.1.1        GigabitEthernet0/0/1
       12.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/1
     12.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/1
       13.1.1.0/24  Direct  0    0           D   13.1.1.1        GigabitEthernet0/0/0
       13.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/0
     13.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/0
       14.1.1.0/24  RIP     100  1           D   12.1.1.2        GigabitEthernet0/0/1
       34.1.1.0/24  RIP     100  1           D   13.1.1.2        GigabitEthernet0/0/0
       45.1.1.0/24  RIP     100  1           D   12.1.1.2        GigabitEthernet0/0/1
                    RIP     100  1           D   13.1.1.2        GigabitEthernet0/0/0
       56.1.1.0/24  RIP     100  1           D   12.1.1.2        GigabitEthernet0/0/1
                    RIP     100  1           D   13.1.1.2        GigabitEthernet0/0/0
       67.1.1.0/24  RIP     100  1           D   12.1.1.2        GigabitEthernet0/0/1
                    RIP     100  1           D   13.1.1.2        GigabitEthernet0/0/0
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值