BGP路由策略配置实例

BGP路由策略配置实例

文章目录

  • BGP路由策略配置实例
    • 需求:
    • 拓扑图
    • 1.Origin属性
    • 3.local-preference(本地优先级属性)
    • 4.MED(Muti-Exit-Discriminator)
    • 5.Preference_Value

需求:

BGP路由策略配置实例_第1张图片

拓扑图

BGP路由策略配置实例_第2张图片

1.Origin属性

思路:尽量在较少的路由器上进行配置;

BGP路由策略配置实例_第3张图片

 #
 ipv4-family unicast
  undo synchronization
  peer 10.1.24.1 enable
  peer 10.1.24.1 route-policy yibai export
  peer 10.1.24.1 advertise-community
  peer 10.1.34.1 enable
  peer 10.1.34.1 route-policy erbai export
  peer 10.1.34.1 advertise-community
  peer 10.1.45.2 enable
  peer 10.1.45.2 route-policy yibai import
  peer 10.1.45.2 advertise-community
  peer 10.1.46.2 enable
  peer 10.1.46.2 route-policy erbai import
  peer 10.1.46.2 advertise-community
#
route-policy yibai permit node 10 
 if-match community-filter yibai 
 apply origin incomplete
#
route-policy yibai permit node 20 
#
route-policy erbai permit node 10 
 if-match community-filter erbai 
 apply origin incomplete
#
route-policy erbai permit node 20 
#
ip community-filter advanced erbai permit 300:200
ip community-filter advanced yibai permit 300:100
#

结果:
BGP路由策略配置实例_第4张图片
BGP路由策略配置实例_第5张图片
2.AS-Path属性
BGP路由策略配置实例_第6张图片


bgp 200
 peer 10.1.24.1 as-number 100 
 peer 10.1.34.1 as-number 100 
 peer 10.1.45.2 as-number 300 
 peer 10.1.46.2 as-number 300 
 #
 ipv4-family unicast
  undo synchronization
  peer 10.1.24.1 enable
  peer 10.1.24.1 route-policy yibai export
  peer 10.1.24.1 advertise-community
  peer 10.1.34.1 enable
  peer 10.1.34.1 route-policy erbai export
  peer 10.1.34.1 advertise-community
  peer 10.1.45.2 enable
  peer 10.1.45.2 advertise-community
  peer 10.1.46.2 enable
  peer 10.1.46.2 advertise-community
#
route-policy yibai permit node 10 
 if-match community-filter yibai 
 apply as-path 200 additive
#
route-policy yibai permit node 20 
#
route-policy erbai permit node 10 
 if-match community-filter erbai 
 apply as-path 200 additive
#
route-policy erbai permit node 20 
#
ip community-filter advanced erbai permit 300:200
ip community-filter advanced yibai permit 300:100
#

BGP路由策略配置实例_第7张图片
BGP路由策略配置实例_第8张图片

3.local-preference(本地优先级属性)

BGP路由策略配置实例_第9张图片

使用前置列表抓取路由
ip ip-prefix loc index 10 permit 200.0.0.0 24

#
使用route-policy设置本地优先级属性
route-policy local permit node 10 
 if-match ip-prefix loc 
 apply local-preference 200 
#
route-policy local permit node 20 
#
将策略运用
  peer 10.1.13.1 route-policy local export
#

BGP路由策略配置实例_第10张图片

4.MED(Muti-Exit-Discriminator)

MED ( Multi-Exit-Discriminator )属性仅在相邻两个AS之间传递;所以利用该特性
BGP路由策略配置实例_第11张图片

5.Preference_Value

去和来的路由都要走一条路,所以需要双向进行路由策略
BGP路由策略配置实例_第12张图片

#
ip community-filter advanced yibai permit 300:100
#
route-policy yibai permit node 10
 if-match community-filter yibai
 apply preferred-value 100
#
route-policy yibai permit node 20
#
bgp 100
  peer 3.3.3.3 route-policy yibai import
#

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