当前位置: 代码迷 >> 综合 >> HCIE———BGP选路实验
  详细解决方案

HCIE———BGP选路实验

热度:5   发布时间:2024-02-01 19:42:51.0

在这里插入图片描述

首先预配ip地址
内部使用ospf
bgp建邻
[R1]bgp 1
[R1-bgp]peer 10.1.2.2 as-number 1
[R1-bgp]peer 10.1.2.2 connect-interface LoopBack 0
[R1-bgp]peer 10.1.13.2 as-number 2
AS1-AS2走R1-R3,增大R2-R4的Local-preference
前缀列表
[R2]ip ip-prefix 12 permit 10.1.0.0 16 greater-equal 32
[R2]ip ip-prefix 12 permit 10.2.0.0 16 greater-equal 32 
匹配前缀列表
[R2]route-policy 12 permit node 10
[R2-route-policy]if-match ip-prefix 12
[R2-route-policy]apply local-preference 150
[R2]route-policy 12 permit node 20
调用
[R2]bgp 1
[R2-bgp]peer 10.0.24.1 route-policy 12 import   
AS2-AS1走R2-R4,增大R2-R4的MED
[R3]ip ip-prefix 21 permit 10.4.0.0 16 greater-equal 32
[R3]ip ip-prefix 21 permit 10.3.0.0 16 greater-equal 32
[R3]route-policy 21 permit node 10
[R3-route-policy]if-match ip-prefix 21
[R3-route-policy]apply cost 100
[R3]route-policy 12 permit node 20
[R3]bgp 2
[R3-bgp]peer 10.0.13.1 route-policy 21 import
AS1-AS3走R2-R6,增加R2-R5的AS-Path
[R2]ip ip-prefix 13 permit 10.1.0.0 16 greater-equal 32
[R2]ip ip-prefix 13 permit 10.2.0.0 16 greater-equal 32
[R2]route-policy 13 permit node 10
[R2-route-policy]if-match ip-prefix 13
[R2-route-policy]apply as-path 8.9 additive 
[R2]route-policy 13 permit node 20
[R2]bgp 1
[R2-bgp]peer 10.0.25.1 route-policy 13 import
AS2-AS3走R4-R6,修改R4-R6的起源属性
[R4]ip ip-prefix 23 permit 10.5.0.0 16 greater-equal 32
[R4]ip ip-prefix 23 permit 10.6.0.0 16 greater-equal 32
[R4]ip ip-prefix 23 permit 10.7.0.0 16 greater-equal 32
[R4]route-policy 23 permit node 10
[R4-route-policy]if-match ip-prefix 23
[R4-route-policy]apply apply origin egp 3
[R4]route-policy 23 permit node 20
[R4]bgp 2
[R4-bgp]peer 10.0.46.1 route-policy 32 import   
AS3-AS1走R5-R2,修改R6-R2的下一跳
[R6]ip ip-prefix 31 permit 10.5.0.0 16 greater-equal 16
[R6]ip ip-prefix 31 permit 10.6.0.0 16 greater-equal 16
[R6]ip ip-prefix 31 permit 10.7.0.0 16 greater-equal 16 
[R6]route-policy 13 permit node 10
[R6-route-policy]if-match ip-prefix 31
[R6-route-policy]apply ip-address next-hop 10.5.1.1 
[R6]route-policy 13 permit node 20
[R6]bgp 3
[R6-bgp]peer 10.0.26.2 route-policy 31 import
AS3-AS2走R6-R4,修改R5-R6Prefval属性
[R5]ip ip-prefix 32 permit 10.4.0.0 16 greater-equal 16
[R5]ip ip-prefix 32 permit 10.3.0.0 16 greater-equal 16
[R5]route-policy 32 permit node 10
[R5-route-policy]if-match ip-prefix 32
[R5-route-policy]apply preferred-value 4
[R5]route-policy 32 permit node 20  
[R5]bgp 3
[R5-bgp]peer 10.6.1.1 route-policy 32 import