hcip——路由策略

要求:

hcip——路由策略_第1张图片

 基础配置

AR1

[R1]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip add 12.0.0.1 24

[R1-GigabitEthernet0/0/0]int g 0/0/1
[R1-GigabitEthernet0/0/1]ip add 14.0.0.1 24

[R1]int loop0
[R1-LoopBack0]ip add 1.1.1.1 24

[R1]rip 1
[R1-rip-1]vers 2
[R1-rip-1]netw 12.0.0.0
[R1-rip-1]netw 14.0.0.0
[R1-rip-1]netw 1.0.0.0

AR2

[R2]int g 0/0/0
[R2-GigabitEthernet0/0/0]ip add 12.0.0.2 24

[R2-GigabitEthernet0/0/0]int s 4/0/0
[R2-Serial4/0/0]ip add 23.0.0.2 24

[R2]int LoopBack 0
[R2-LoopBack0]ip add 2.2.2.1 24

[R2]rip 1
[R2-rip-1]vers 2
[R2-rip-1]network 12.0.0.0
[R2-rip-1]network 2.0.0.0

[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 23.0.0.0 0.0.0.255

AR3

[R3]int s 4/0/0
[R3-Serial4/0/0]ip add 23.0.0.3 24

[R3-Serial4/0/0]int s 4/0/1
[R3-Serial4/0/1]ip add 34.0.0.3 24

[R3]int LoopBack 0
[R3-LoopBack0]ip add 3.3.3.1 24
[R3-LoopBack0]ospf network-type broadcast 

[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 23.0.0.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]network 34.0.0.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]network 3.3.3.0 0.0.0.255

AR4

[R4]int s 4/0/0
[R4-Serial4/0/0]ip add 34.0.0.4 24

[R4-Serial4/0/0]int g 0/0/0
[R4-GigabitEthernet0/0/0]ip add 14.0.0.4 24
 
[R4]int LoopBack 0
[R4-LoopBack0]ip add 4.4.4.1 24
[R4-LoopBack0]ospf network-type broadcast 

[R4]rip 1
[R4-rip-1]vers 2

[R4-rip-1]network 14.0.0.0

[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]network 34.0.0.0 0.0.0.255
[R4-ospf-1-area-0.0.0.0]network 4.4.4.0 0.0.0.255

多点双向重发布

AR2

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

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

AR4

[R4]rip 1
[R4-rip-1]import-route ospf 1

[R4]ospf 1
[R4-ospf-1]import-route rip 1

查看

hcip——路由策略_第2张图片

策略

由于需要存在备份路由所以采用route-policy

AR1

在此所有策略在ASBR上配置

hcip——路由策略_第3张图片

 分析:3.3.3.0 走负载均衡 ;4.4.4.0 走14.0.0.4为主路 ;23.0.0.0 走12.0.0.2 为主路 

34.0.0.0 走14.0.0.4为主路 

R2---------------------------------------------------
[R2]ip ip-prefix 11 permit 4.4.4.0 24
[R2]ip ip-prefix 12 permit 34.0.0.0 24

[R2]route-policy 1 permit node 5
Info: New Sequence of this List.
[R2-route-policy]if-match ip-prefix 11
[R2-route-policy]apply cost-type type-1
[R2-route-policy]apply cost 10

[R2]route-policy 1 permit node 10
Info: New Sequence of this List.
[R2-route-policy]if-match ip-prefix 12
[R2-route-policy]apply cost-type type-1
[R2-route-policy]apply cost 10

[R2]route-policy 1 permit node 50
	
[R2]rip 1	
[R2-rip-1]import-route ospf 1 route-policy 1

R4-------------------------------------------------------
[R4]ip ip-prefix 11 permit 23.0.0.0 24

[R4]route-policy 1 permit node 5
Info: New Sequence of this List.
[R4-route-policy]if-match ip-prefix 11
[R4-route-policy]apply cost-type type-1
[R4-route-policy]apply cost 10

[R4]route-policy 1 permit node 50


[R4]rip 1
[R4-rip-1]import-route ospf 1 route-policy 1

hcip——路由策略_第4张图片

 AR2

hcip——路由策略_第5张图片

 选路正常

AR3

hcip——路由策略_第6张图片

 分析:1.1.1.0 走负载均衡, 2.2.2.0 走23.0.0.2, 12.0.0.0走23.0.0.2 14.0.0.0走34.0.0.4

R2-----------------------------------------------------
[R2]ip ip-prefix 21 permit 14.0.0.0 24

[R2]route-policy 2 permit node 5
Info: New Sequence of this List.
[R2-route-policy]if-match ip-prefix 21	
[R2-route-policy]apply cost 10

[R2]route-policy 2 permit node 50

[R2]ospf 1
[R2-ospf-1]import-route rip 1 route-policy 2

R4--------------------------------------------------
[R4]ip ip-prefix 21 permit 12.0.0.0 24
[R4]ip ip-prefix 22 permit 2.2.2.0 24

[R4]route-policy 2 permit node 5
Info: New Sequence of this List.
[R4-route-policy]if-match ip-prefix 21	
[R4-route-policy]apply cost 10

[R4]route-policy 2 permit node 10
Info: New Sequence of this List.
[R4-route-policy]if-match ip-prefix 22
[R4-route-policy]apply cost + 10

[R4]route-policy 2 permit node 50

[R4-ospf-1]import-route rip 1 route-policy 2

hcip——路由策略_第7张图片

 AR4

hcip——路由策略_第8张图片

  选路正常

你可能感兴趣的:(hcip,网络)