双点双向重发布

实验拓扑与要求:

实验步骤:

①配地址

②启动协议并宣告网段

③双点双向重发布

import-route

④在ospf中进行过滤

在R3上查看路由表

[R3]display ip routing-table protocol ospf 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
         Destinations : 10       Routes : 18       

OSPF routing table status : <Active>
         Destinations : 10       Routes : 18

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        1.1.1.0/24  O_ASE   150  1           D   10.0.23.2       GigabitEthernet
0/0/1
                    O_ASE   150  1           D   10.0.34.4       GigabitEthernet
0/0/0
        2.2.2.0/24  O_ASE   150  1           D   10.0.23.2       GigabitEthernet
0/0/1
                    O_ASE   150  1           D   10.0.34.4       GigabitEthernet
0/0/0
        4.4.4.0/24  O_ASE   150  1           D   10.0.23.2       GigabitEthernet
0/0/1
        4.4.4.4/32  OSPF    10   1           D   10.0.34.4       GigabitEthernet
0/0/0
      10.0.12.0/24  O_ASE   150  1           D   10.0.23.2       GigabitEthernet
0/0/1
                    O_ASE   150  1           D   10.0.34.4       GigabitEthernet
0/0/0
      10.0.14.0/24  O_ASE   150  1           D   10.0.23.2       GigabitEthernet
0/0/1
                    O_ASE   150  1           D   10.0.34.4       GigabitEthernet
0/0/0
     172.16.1.0/24  O_ASE   150  1           D   10.0.23.2       GigabitEthernet
0/0/1
                    O_ASE   150  1           D   10.0.34.4       GigabitEthernet
0/0/0
     172.16.2.0/24  O_ASE   150  1           D   10.0.23.2       GigabitEthernet
0/0/1
                    O_ASE   150  1           D   10.0.34.4       GigabitEthernet
0/0/0
     172.16.3.0/24  O_ASE   150  1           D   10.0.23.2       GigabitEthernet
0/0/1
                    O_ASE   150  1           D   10.0.34.4       GigabitEthernet
0/0/0
     172.16.4.0/24  O_ASE   150  1           D   10.0.23.2       GigabitEthernet
0/0/1
                    O_ASE   150  1           D   10.0.34.4       GigabitEthernet
0/0/0

OSPF routing table status : <Inactive>
         Destinations : 0        Routes : 0

可以看到R4的环回口有两条路由,这是因为ospf 协议传递本地环回接口网段时,为 32 位主机路由;但若将本地环回通过重发布导入其他路由时,基于本地路由表中的直连路由进行;若本地直连 路由为其他长度掩码,将使得该网络出现两条掩码不同的路由来在整个网路传递;

解决:1)环回接口配置32 位掩码ip 地址 2)修改环回接口的网络类型

[R4-LoopBack0]ospf network-type broadcast 

 接下来处理172.16.1.0-172.16.4.0 

在R2和R4上相同的操作

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

route-policy 1 deny node 10 
 if-match ip-prefix 1 

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

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

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

route-policy 1 permit node 50    //末尾隐含拒绝所有,这张空表的意思是允许所有

ospf 1 
 import-route rip 1 route-policy 1    

查看ospf routing

<R3>display ospf routing 

	 OSPF Process 1 with Router ID 3.3.3.3
		  Routing Tables 

 Routing for Network 
 Destination        Cost  Type       NextHop         AdvRouter       Area
 3.3.3.3/32         0     Stub       3.3.3.3         3.3.3.3         0.0.0.0
 10.0.23.0/24       1     Transit    10.0.23.3       3.3.3.3         0.0.0.0
 10.0.34.0/24       1     Transit    10.0.34.3       3.3.3.3         0.0.0.0
 4.4.4.0/24         1     Stub       10.0.34.4       4.4.4.4         0.0.0.0

 Routing for ASEs
 Destination        Cost      Type       Tag         NextHop         AdvRouter
 1.1.1.0/24         1         Type2      1           10.0.34.4       4.4.4.4
 1.1.1.0/24         1         Type2      1           10.0.23.2       2.2.2.2
 2.2.2.0/24         1         Type2      1           10.0.34.4       4.4.4.4
 2.2.2.0/24         1         Type2      1           10.0.23.2       2.2.2.2
 10.0.12.0/24       1         Type2      1           10.0.34.4       4.4.4.4
 10.0.12.0/24       1         Type2      1           10.0.23.2       2.2.2.2
 10.0.14.0/24       1         Type2      1           10.0.34.4       4.4.4.4
 10.0.14.0/24       1         Type2      1           10.0.23.2       2.2.2.2
 172.16.2.0/24      2         Type1      1           10.0.34.4       4.4.4.4
 172.16.2.0/24      2         Type1      1           10.0.23.2       2.2.2.2
 172.16.3.0/24      6         Type2      1           10.0.34.4       4.4.4.4
 172.16.3.0/24      6         Type2      1           10.0.23.2       2.2.2.2
 172.16.4.0/24      10        Type1      1           10.0.34.4       4.4.4.4
 172.16.4.0/24      10        Type1      1           10.0.23.2       2.2.2.2

 Total Nets: 18 
 Intra Area: 4  Inter Area: 0  ASE: 14  NSSA: 0 

 根据实验要求我们要给2.2.2.0 10.0.12.0 和10.0.14.0 进行最佳选路

[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    //type1优于type2
[R2]ip ip-prefix haha permit 10.0.12.0 24
[R2]route-policy 1 permit node 25
[R2-route-policy]if-match ip-prefix haha	
[R2-route-policy]apply cost-type type-1
[R4]ip ip-prefix xiha permit 10.0.14.0 24	
[R4]route-policy 1 permit node 15	
[R4-route-policy]if-match ip-prefix xiha
[R4-route-policy]apply cost-type type-1

⑤在rip中进行过滤 

先看路由表

[R1]display ip routing-table protocol rip 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : RIP
         Destinations : 5        Routes : 9        

RIP routing table status : <Active>
         Destinations : 5        Routes : 9

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        2.2.2.0/24  RIP     100  1           D   10.0.12.2       GigabitEthernet
0/0/0
        3.3.3.3/32  RIP     100  1           D   10.0.12.2       GigabitEthernet
0/0/0
                    RIP     100  1           D   10.0.14.4       GigabitEthernet
0/0/1
        4.4.4.0/24  RIP     100  1           D   10.0.14.4       GigabitEthernet
0/0/1
                    RIP     100  1           D   10.0.12.2       GigabitEthernet
0/0/0
      10.0.23.0/24  RIP     100  1           D   10.0.12.2       GigabitEthernet
0/0/0
                    RIP     100  1           D   10.0.14.4       GigabitEthernet
0/0/1
      10.0.34.0/24  RIP     100  1           D   10.0.14.4       GigabitEthernet
0/0/1
                    RIP     100  1           D   10.0.12.2       GigabitEthernet
0/0/0

RIP routing table status : <Inactive>
         Destinations : 0        Routes : 0

处理4.4.4.0 10.0.23.0 和 10.0.34.0 网段

[R1]ip ip-prefix 4 permit 4.4.4.0 24
[R1]int g 0/0/0
[R1-GigabitEthernet0/0/0]rip metricin ip-prefix 4 2
// 给上面的链路cost值加2
[R1]ip ip-prefix 23 permit 10.0.23.0 24
[R1]int g 0/0/1
[R1-GigabitEthernet0/0/1]rip metricin ip-prefix 23 2
[R1]ip ip-prefix 34 permit 10.0.34.0 24
[R1]int g 0/0/0	
[R1-GigabitEthernet0/0/0]rip metricin ip-prefix 34 2

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值