BGP策略路由
合集下载
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
if community matches-every(12:34, 56:78) then if med eq 8 then drop endif set local-preference 100 endif
RST-2320 12813_05_2006_X
© 2006 Cisco Systems, Inc. All rights reserved.
route-policy one set weight 100 end-policy route-policy two set med 200 end-policy route-policy three apply two set community (2:666) additive end-policy route-policy four apply one apply three pass end-policy
Cisco Public
14
Hierarchy and parameterization
• When any policy or set is modified, that change affects all instances of policy hierarchies that reference the modified policy or set. May impact performance! • Looping/recursion is not allowed • As many layers of hierarchy or parameters that you want • Parameters are passed by value only
• Human-readable
RST-2320 12813_05_2006_X
© 2006 Cisco Systems, Inc. All rights reserved.
Cisco Public
17
BGP Bestpath
RST-2320 12813_05_2006_X
RST-2320 12813_05_2006_X
© 2006 Cisco Systems, Inc. All rights reserved.
Cisco Public
2
This is an interactive session.... Don’t hesitate to stop me to ask a question!
RST-2320 12813_05_2006_X
© 2006 Cisco Systems, Inc. All rights reserved.
Cisco Public
16
Why RPL?
• Improved Clarity
No Silently skipped statements. What you see is what you get!
if med eq 42 and next-hop in (1.1.1.1) then if med eq 10 and not destination in (10.1.3.0/24) or community is (56:78) if med eq 10 and (not destination in (10.1.3.0/24)) or community is (56:78)
if as-path in as-path-set-1 then drop endif
The if statement also permits an else clause, which is executed if the expression is false.
if med eq 150 then set local-preference 10 elseif med eq 200 then set local-preference 60 else set local-preference 0 endif
Designed to reduce some of the redundancy that is inherent in routemap configuration.
• RPL is a tool for implementing routing Policy.
RPL helps to manipulate route attributes and route selection.
RST-2320 12813_05_2006_X
© 2006 Cisco Systems, Inc. All rights reserved.
Cisco Public
12
Hierarchical Policy
• A policy which refers to another policy with an apply statement.
• Use the policy:
router bgp 1 neighbor 2.2.2.2 address-family ipv4 unicast route-policy policy1 out
RST-2320 12813_05_2006_X
© 2006 Cisco Systems, Inc. All rights reserved.
BGP Policy
RST-2320
RST-2320 12813_05_2006_X
© 2006 Cisco Systems, Inc. All rights reserved.
Cisco Public
1
Your Speaker
Nehal Bhau IOS-XR RPL & BGP Developer San Jose, CA nbhau@cisco.com
RST-2320 12813_05_2006_X
© 2006 Cisco Systems, Inc. All rights reserved.
Cisco Public
4
Introduction to RPL
RST-2320 12813_05_2006_X
© 2006 Cisco Systems, Inc. All rights reserved.
route-policy one ($med) set med $med end-policy route-policy two apply one (10) end-policy
RST-2320 12813_05_2006_X
© 2006 Cisco Systems, Inc. All rights reserved.
RST-2320 12813_05_2006_X
© 2006 Cisco Systems, Inc. All rights reserved.
Cisco Public
8
RPL Building Blocks
• Simple if-then-else-elseif statements. • Boolean operators to combine multiple statements. • Hierarchical and parameterized policy definitions for modularity. • Unordered sets to form operand templates. • Protocol specific constructs: as-path, community, med, tag, metric etc.
RST-2320 12813_05_2006_X
© 2006 Cisco Systems, Inc. All rights reserved.
Cisco Public
6
Configuring a route policy
定义策略!
• Define the policy:
route-policy policy1 statement 1 …. end-policy
RST-2320 12813_05_2006_X
© 2006 Cisco Systems, Inc. All rights reserved.
Cisco Public
3
BGP Policy
• Introduction to RPL • BGP Bestpath • Influencing the Bestpath • Some Applications • RPL syntax
RST-2320 12813_05_2006_X
© 2006 Cisco Systems, Inc. All rights reserved.
Cisco Public
Fra Baidu bibliotek
9
If-then, Elseif
An if statement uses a conditional expression to decide which actions or dispositions should be taken for the given route.
RST-2320 12813_05_2006_X © 2006 Cisco Systems, Inc. All rights reserved.
Cisco Public
10
Nested If
The statements within an if statement may themselves be if statements:
RST-2320 12813_05_2006_X © 2006 Cisco Systems, Inc. All rights reserved.
Cisco Public
13
Parameterized Policy
• A hierarchical policy that passes values.
Cisco Public
11
Boolean Expressions
•Boolean expressions evaluate as either true or false. •RPL provides means to build compound conditions from simple conditions by means of Boolean operators. •There are three Boolean operators : negation (not), conjunction (and), and disjunction (or).
• Modularity
Exploit modularity configuration. to reuse common portions of
• Parameterization
For elements which are not exact copies of each other we can add parameterization ( think variables ) to get further reuse.
RST-2320 12813_05_2006_X
© 2006 Cisco Systems, Inc. All rights reserved.
Cisco Public
15
Why RPL?
• Scaling
Using route-maps could lead to 100k – 1M lines of configuration (e.g. 1000s of BGP peers).
Cisco Public
7
Editing a route-policy
• Route-policy defines are atomic & non-incremental. • Invoke your favorite editor to do incremental changes:
edit route-policy policy1 [emacs | vim]
Cisco Public
5
What is RPL?
• Route Policy Language (RPL) • The Routing Policy Language (RPL) was developed to support large scale routing configurations.