双向重发布实验

本文描述了在一个网络环境中如何配置华为路由器的IP地址、RIP和OSPF协议。接着,进行了双点双向重发布,并针对路由表中的选路问题进行了优化,以确保更合适的路径选择。通过对路由策略的调整,解决了不同网段的负载均衡问题。
摘要由CSDN通过智能技术生成

第一步:配置IP地址 

R1

<Huawei>sys
Enter system view, return user view with Ctrl+Z..
[Huawei]sys R1
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip address 12.1.1.1 24
Jul 29 2023 13:18:17-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R1-GigabitEthernet0/0/0]int g0/0/1  
[R1-GigabitEthernet0/0/1]ip address 41.1.1.1 24
Jul 29 2023 13:18:46-08:00 R1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[R1]interface LoopBack 0
[R1-LoopBack0]ip address 10.1.1.1 24
[R1-LoopBack0]

R2

[R2]int g0/0/0 
[R2-GigabitEthernet0/0/0]ip address 12.1.1.2 24 
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip address 23.1.1.2 24
[R2-GigabitEthernet0/0/1]int l0    
[R2-LoopBack0]ip address 20.1.1.1 24

R3

[R3]int l0 
[R3-LoopBack0]ip address 30.1.1.1 24
[R3-LoopBack0]int g0/0/0   
[R3-GigabitEthernet0/0/0]ip address 23.1.1.3 24
[R3-GigabitEthernet0/0/0]int g0/0/1
[R3-GigabitEthernet0/0/1]ip address 34.1.1.3 24

R4 

 [R4]int l0
[R4-LoopBack0]ip address 40.1.1.1 24
[R4-LoopBack0]int g0/0/0
[R4-GigabitEthernet0/0/0]ip address 34.1.1.4 24
[R4-GigabitEthernet0/0/0]int g0/0/1
[R4-GigabitEthernet0/0/1]ip address 41.1.1.4 24

第二步:配置rip和ospf协议

R1

 [R1]rip 1
[R1-rip-1]version 2 
[R1-rip-1]network 12.0.0.0 
[R1-rip-1]network 41.0.0.0   
[R1-rip-1]network 10.0.0.0

R2

 [R2]rip 1
[R2-rip-1]network 12.0.0.0
[R2-rip-1]network 20.0.0.0
[R2-rip-1]q 
[R2]ospf  1 router-id 1.1.1.1   
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]ne    
[R2-ospf-1-area-0.0.0.0]network 23.1.1.0 0.0.0.255

R3

[R3]ospf 1 router-id 2.2.2.2
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 23.1.1.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]network 34.1.1.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]network 30.1.1.0 0.0.0.255

R4 

 [R4]rip 1
[R4-rip-1]version 2
[R4-rip-1]network 41.0.0.0
[R4-rip-1]q  
[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]area 0  
[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 40.1.1.0 0.0.0.255

第三步:双点双向重发布

双点指的是两台ASBR路由器,双向指的是ASBR两边路由协议互相进行重发布  

R2

[R2]rip 1  
[R2-rip-1]import-route ospf 1
[R2-rip-1]q  
[R2]ospf 1 router-id 1.1.1.1 
[R2-ospf-1]import-route rip 1

R4 

[R4]rip 1  
[R4-rip-1]import-route ospf 1
[R4-rip-1]q
[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]import-route rip 1

第四步:查看路由表 

R3 

R1 

第五步:解决选路不佳

R1和R3设备在访问对端环回地址时为等负载均衡,但是R1访问23.1.1.0网段很明显选上边的路更合适,R1访问40.1.1.0网段很明显选下边的路更合适,已经不适合进行等负载均衡,故需要进行干涉选路 。

 [R3-LoopBack0]ospf network-type broadcast 

[R4-LoopBack0]ospf network-type broadcast

R2 上的配置

#解决40.1.1.0和34.1.1.0网段

 [R2]ip ip-prefix 1 permit 40.1.1.0 24
[R2]route-policy 1 permit node 10
Info: New Sequence of this List.
[R2-route-policy]if-match ip-prefix 1
[R2-route-policy]apply cost + 10
[R2-route-policy]q
[R2]route-policy 1 permit node 20
Info: New Sequence of this List.
[R2-route-policy]q
[R2]rip 1
[R2-rip-1]import-route ospf 1 route-policy 1
[R2-rip-1]q
[R2]ip ip-prefix 2 permit 34.1.1.0 24
[R2]route-policy 1 permit node 15
Info: New Sequence of this List.
[R2-route-policy]if-match ip-prefix 2
[R2-route-policy]apply  cost + 10

#解决12.1.1.0和20.1.1.0网段

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

R4上的配置 

解决23.1.1.0路段

[R4]ip ip-prefix 1 permit 23.1.1.0 24
[R4]route-policy 1 permit node 10
Info: New Sequence of this List.
[R4-route-policy]if-match ip-prefix 1
[R4-route-policy]apply cost + 10
[R4-route-policy]q
[R4]route-policy 1 permit node 20
Info: New Sequence of this List.
[R4-route-policy]q
[R4]rip 1 
[R4-rip-1]import-route ospf 1 route-policy 1 

#解决41.1.1.0路段
[R4]ip ip-prefix 14 permit 41.1.1.0 24
[R4]route-policy 14 permit node 10
Info: New Sequence of this List.
[R4-route-policy]if-match ip-prefix 14
[R4-route-policy]apply cost-type type-1 
[R4-route-policy]apply cost - 10
[R4-route-policy]q  
[R4]route-policy 14 permit node 20
Info: New Sequence of this List.
[R4-route-policy]q 
[R4]ospf 1
[R4-ospf-1]import-route rip 1 route-policy 14 

第六步:查看路由表和测试

R1

 R3

 测试

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

孤冢清风666

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

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

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

打赏作者

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

抵扣说明:

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

余额充值