OSPF重发布

一、进行IP配置:

R1:

[r1]

 sysname r1

interface Serial4/0/0

 link-protocol ppp

 ip address 10.1.12.1 255.255.255.0

interface GigabitEthernet0/0/0

 ip address 10.1.14.1 255.255.255.0

interface LoopBack0

 ip address 1.1.1.1 255.255.255.0   

rip 1

 version 2

 network 1.0.0.0

 network 10.0.0.0

R2:

[r2]

 sysname r2

interface Serial4/0/0

 link-protocol ppp

 ip address 10.1.23.2 255.255.255.0

interface Serial4/0/1

 link-protocol ppp

 ip address 10.1.12.2 255.255.255.0

interface LoopBack0

 ip address 2.2.2.2 255.255.255.0        

ospf 1 router-id 2.2.2.2

 import-route rip 1

 area 0.0.0.0

  network 10.1.23.0 0.0.0.255

rip 1

 version 2

 network 2.0.0.0

 network 10.0.0.0

 import-route ospf 1

R3:

[r3]dis current-configuration

[V200R003C00]

 sysname r3

interface Serial4/0/0

 link-protocol ppp

 ip address 10.1.34.3 255.255.255.0

interface Serial4/0/1

 link-protocol ppp

 ip address 10.1.23.3 255.255.255.0

interface LoopBack0

 ip address 3.3.3.3 255.255.255.0        

ospf 1 router-id 3.3.3.3

 area 0.0.0.0

  network 3.3.3.0 0.0.0.255

  network 10.1.23.0 0.0.0.255

  network 10.1.34.0 0.0.0.255

R4:

[r4]

 sysname r4

interface Serial4/0/1

 link-protocol ppp

 ip address 10.1.34.4 255.255.255.0

interface GigabitEthernet0/0/1

 ip address 10.1.14.4 255.255.255.0

interface LoopBack0

 ip address 4.4.4.4 255.255.255.0        

ospf 1 router-id 4.4.4.4

 import-route rip 1

 area 0.0.0.0

  network 10.1.34.0 0.0.0.255

rip 1

 version 2

 network 4.0.0.0

 network 10.0.0.0

 import-route ospf 1

二、启动动态路由协议及重发布:

[r1]

rip 1

 version 2

 network 1.0.0.0

 network 10.0.0.0

[r2]

ospf 1 router-id 2.2.2.2

 import-route rip 1

 area 0.0.0.0

  network 10.1.23.0 0.0.0.255

rip 1

 version 2

 network 2.0.0.0

 network 10.0.0.0

 import-route ospf 1

[r3]

ospf 1 router-id 3.3.3.3

 area 0.0.0.0

  network 3.3.3.0 0.0.0.255

  network 10.1.23.0 0.0.0.255

  network 10.1.34.0 0.0.0.255

[r4]

ospf 1 router-id 4.4.4.4

 import-route rip 1

 area 0.0.0.0

  network 10.1.34.0 0.0.0.255

rip 1

 version 2

 network 4.0.0.0

 network 10.0.0.0

 import-route ospf 1

三、重发布后检测路由表

R1:

 R3:

 从图中可以看出,R1去往OSPF协议中的路由网段均实现负载均衡,R3同理;若要使R1进行正确的选路需要使用路由策略规划。

四、路由策略:

一、OSPF区域干涉选路(rip同理):

从上图可以得知,R3去往10.1.12.0网段和2.2.2.0换回的时候是负载均衡,但作为管理员的我们得知AR3去往10.1.12.0 和2.2.2.0网段时经过R2可以减少带宽。故使用路由策略进行干涉。同理,在R4上进行选路干涉。

在R2上进行路由策略:

route-policy 11 permit node 10     修改度量,来达到选路效果

 if-match ip-prefix 1

 apply cost 10            

route-policy 11 permit node 20     

 if-match ip-prefix 2

 apply cost 10

route-policy 11 permit node 60     由于路由策略末尾拒绝所有,所以需要创建一个新的表来允许所有。

route-policy aa permit node 10

 if-match ip-prefix aa                   

 apply cost 10

 apply cost-type type-1            修改类型 由于类型1大于类型2

route-policy aa permit node 20

 if-match ip-prefix bb

 apply cost-type type-1

route-policy aa permit node 50

抓流量:

ip ip-prefix 1 index 10 permit 4.4.4.0 24       

ip ip-prefix 2 index 10 permit 10.1.34.0 24

ip ip-prefix aa index 10 permit 2.2.2.0 24

ip ip-prefix bb index 10 permit 10.1.12.0 24

同理,在AR4上同样进行选路:

route-policy 11 permit node 10

 if-match ip-prefix 1

 apply cost 10

route-policy 11 permit node 20

 if-match ip-prefix 2

 apply cost 10

route-policy 11 permit node 60           

route-policy aa permit node 10

 if-match ip-prefix 3

 apply cost-type type-1

route-policy aa permit node 20

ip ip-prefix 1 index 10 permit 3.3.3.0 24

ip ip-prefix 2 index 10 permit 10.1.23.0 24

ip ip-prefix 3 index 10 permit 10.1.14.0 24

ip ip-prefix nn index 10 permit 2.2.2.0 24

二、进行路由策略后,需要重发布技术将策略发布到OSPF中(rip同理)

[r4]

 import-route rip 1 route-policy aa

[r2]

 import-route ospf 1 route-policy 11

 五、选路进行测试:

R1:

 R3:

 从图中可发现,选路已成功干涉。

六、解决由于rip的水平分割而导致的选路不佳问题:

一、特殊情况:

由于不稳定元素而导致路由断开再重连时,由于rip的收敛不及时,rip会因为右侧的ospf重发布进来的路由导致到达2.2.2.0的路由选路不佳,随后在图上会看到下述情况:

 二、解决方案:
在R4上堵塞2.2.2.0的路由以避免AR1选路不佳。

[r4]
interface GigabitEthernet0/0/1
 ip address 10.1.14.4 255.255.255.0 
 rip metricout ip-prefix nn 2
ip ip-prefix nn index 10 permit 2.2.2.0 24

七、备份测试:

断开AR3上的S4/0/1接口:

从上图可以看到,即便断开s4/0/1的接口,AR3依然可以有全网的路由。

至此,实验结束。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值