路由策略小实验

路由策略小实验_第1张图片

 实验要求:

1、R1环回使用重发布,R2和R3使用双向重发布

2、使用路由策略解决,选路不佳

第一步,基础配置

[R1]int l0
[R1-LoopBack0]ip add 1.1.1.1 24
[R1-LoopBack0]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.12.1 24
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 192.168.13.1 24

[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 192.168.12.2 24
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 192.168.24.2 24

[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 192.168.13.3 24
[R3-GigabitEthernet0/0/0]int g0/0/1
[R3-GigabitEthernet0/0/1]ip add 192.168.34.3 24

[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 192.168.24.4 24
[R4-GigabitEthernet0/0/0]int g0/0/1
[R4-GigabitEthernet0/0/1]ip add 192.168.34.4 24

[R1]ospf 1 rou 1.1.1.1
[R1-ospf-1]a 0
[R1-ospf-1-area-0.0.0.0]net 192.168.12.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]net 192.168.13.1 0.0.0.0

[R2]ospf 1 rou 2.2.2.2
[R2-ospf-1]a 0
[R2-ospf-1-area-0.0.0.0]net 192.168.12.2 0.0.0.00

[R3]ospf 1 rou 3.3.3.3
[R3-ospf-1]a 0
[R3-ospf-1-area-0.0.0.0]net 192.168.13.3 0.0.0.0

[R2]rip 1
[R2-rip-1]v 2
[R2-rip-1]undo sum
[R2-rip-1]net 192.168.24.0

[R3]rip 1
[R3-rip-1]v 2
[R3-rip-1]undo sum
[R3-rip-1]net 192.168.34.0

[R4]rip 1
[R4-rip-1]v 2
[R4-rip-1]undo sum
[R4-rip-1]net 192.168.34.0
[R4-rip-1]net 192.168.24.0

第二步,R1直连重发布

[R1]ospf 1
[R1-ospf-1]import-route direct

直连重发布,会将R1直连的3条路由发送进去,但是我们仅需要l0的,所以要对另外两条,做路由策略

[R1]acl 2000
[R1-acl-basic-2000]rule permit source 192.168.13.0 0
[R1]ip ip-prefix aa permit 192.168.12.0 24

[R1]route-policy hcip deny node 10  
Info: New Sequence of this List.
[R1-route-policy]if-	
[R1-route-policy]if-match acl 2000
[R1-route-policy]route-policy hcip deny node 20
Info: New Sequence of this List.
[R1-route-policy]if-match ip-p	
[R1-route-policy]if-match ip-prefix aa
[R1-route-policy]route-policy hcip permit node 30
Info: New Sequence of this List.

[R1]ospf 1 
[R1-ospf-1]import-route direct route-policy hcip

第三步、R2和R3双向重发布

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

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

查看此时,各路由器的路由表

路由策略小实验_第2张图片

 R1存在问题:去往192.168.24.0/24和192.168.34.0/24负载均衡

路由策略小实验_第3张图片

 R2看来似乎没有问题

路由策略小实验_第4张图片

 R3似乎也没有问题

路由策略小实验_第5张图片

 R4和R1相同出现负载均衡,在192.168.12.0/24和192.168.13.0/24

解决:

R1,希望去往192.168.24.0/24,下一跳为192.168.12.2

        希望去往192.168.34.0/34,下一跳为192.168.13.3

[R2]acl 2000
[R2-acl-basic-2000]rule deny source 192.168.34.0 0
[R2-acl-basic-2000]rule permit
[R2-acl-basic-2000]q
[R2]ospf 1
[R2-ospf-1]filter-policy 2000 export 

[R3]acl 2000
[R3-acl-basic-2000]rule deny source 192.168.24.0 0
[R3-acl-basic-2000]rule permit
[R3-acl-basic-2000]q
[R3]ospf 1
[R3-ospf-1]filter-policy 2000 export

路由策略小实验_第6张图片

 

R4,希望去往192.168.12.0/24,下一跳为192.168.24.2

        希望去往192.168.13.0/34,下一跳为192.168.34.3

[R4]ip ip-prefix aa permit 192.168.12.0 24
[R4]int g0/0/1
[R4-GigabitEthernet0/0/1]rip metricin ip-prefix aa 5

[R4]ip ip-prefix bb permit 192.168.13.0 24
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]rip metricin ip-prefix bb 5

路由策略小实验_第7张图片

 

你可能感兴趣的:(网络,实验,HCIP,网络,linux,运维)