CCNP-属性学习笔记

advertisement
乐档网,我分享,我快乐!
http://www.ledlh.cn/
本文档下载自乐档网,更多免费文档请访问网址 http://www.ledlh.cn
http://www.ledlh.cn/doc/info-ae2c7249168884868762d663.html
CCNP-属性学习笔记
CCNP-13 条学习笔记
04-BGP path select
2009 年 6 月 25 日 16:47
How the Best Path Algorithm Works
BGP assigns the first valid path as the current best path. BGP then compares the best
path with the next pathin the list, until BGP reaches the end of the list of valid
paths. This list provides the rules that are used todetermine the best path:
1. prefer the path with the highest weightNote: WEIGHT is a Cisco-specificparameter,
it is local to the router on which it is configured.
2.prefer the path with the highest LOCAL_PREF.Note: A path without LOCAL_PREF is
considered to have had the value set with the Bgp default local-preferencecommand,
or to have a value of 100 by default.
3.prefer the path that was locally originated via a network or aggregateBGP subcommand
or through redistribution form
an IGP.Local paths that are sourced by the
networkor redistributecommands are preferred over local aggregates that are sourced
by the aggregate-addresscommand.
乐档网,我分享,我快乐!
http://www.ledlh.cn/
4.Prefer the path with the shortest AS_PATH.
Note: Be aware of these items:○This step is skipped if you have configured thebgp
bestpath as?pathignore command.
○An AS_SET counts as 1, no matter how many ASs are in the set.
○The AS_CONFED_SEQUENCE and AS_CONFED_SET are not included in the AS_PATH
length.
5.Prefer the path with the lowest origin type.
Note: IGP is lower than
Exterior Gateway Protocol (EGP), and EGP is lower than INCOMPLETE.
6.prefer the path with the lowest multi-exit discriminator (MED)Note: be aware of
these items:a.This comparison only occurs if the first (the neighboring ) AS is the
same in the two paths. Any confederation sub-Ass are ignored.
in other words, MEDs are compared only if the first AS in the AS_SEQUENCE is the same
for
multiple
paths,
any
preceding
AS_CONFED_SEQUENCE
is
ignored.b.If
BGP
always-compare-med is enabled, MEDs are compared for all paths that consist only of
AS_CONFED_SEQUENCE.1)These paths originated within the local confederation.
c.The MED of paths that are received from a neighbor with a MED of 4294967295 is changed
before insertion into the BGP table. The MED changes to 4294967294
d.Paths received with no MED are assigned a MED of 0, unless you have enabled bgp
bestpath med missing-as-worst
1)If you have enabled bgp bestpath med missing-as-worst, the paths are assigned a
乐档网,我分享,我快乐!
http://www.ledlh.cn/
MED of 4294967294
e.The bgp deterministic med command can also influence this step
1)Refer to how BGP routers use the multi-exit discriminator for best path selection
for a demonstration
7.Prefer
eBGP
over
iBGP
pathsIf
best
path
is
selected,
go
to
step
9
(multipath)NOTE:paths that contain AS_CONFED_SEQUENCE and AS_CONFED_SET are local
to the confederation, therefore, these paths are treated as internal paths, there
is no distinction between confederation external and confederation
internal.
8.prefer the path with the lowest IGP metric to the BGP next hopContinue, even if
bestpath is already selected.
9.determine if multiple paths require installation in the routing table for BGP
multipathContinue, if bestpath is not yet selected.
10.when both paths are external, prefer the path that was received first (the oldest
one)This step minimizes route-flap because a newer path does not displace an older
one, even if the newer path would be the preferred route based on the next decision
criteria (steps 11, 12, and 13)
Skip this step if any of these items is true:
You have enabled the bgp best path
compare-routeridcommand.Note: cisco ios software releases 12.0.11S, 12.0.11SC,
12.0.11S3, 12.1.3, 12.1.3AA,12.1.3.T, and 12.1.3.E
command.
introduced this
乐档网,我分享,我快乐!
http://www.ledlh.cn/
The router ID is the same for multiple paths because the routes were received from
the samerouter.
There is no current best path.The current best path can be lost
when, for example, the neighbor that offers the path goes down.
分区 CCNP 的第 1 页
11.prefer the route that comes from the BGP router with the lowest router ID.The router
ID is the highest IP address on the router, with preference given to loopback addresses,
also, you
can use the bgp router-idcommand to manually set the router ID.Note: if a path contains
route reflector (RR) attributes, the originator ID is substituted for the router ID
in the path selection process.
12:If the originator or router ID is the same for multiple paths, prefer the path
with the minimum cluster
list length.
This is only present in BGP
RR environments. It allows clients to peer with RRs or clients in other
clusters. In this scenario, the client must be aware of the RR?specific BGP attribute.
13.Prefer the path that comes from the lowest neighbor address.
This
address is the IP address that is used in the BGP neighbor configuration. The address
corresponds to the remote peer that is used in the TCP connection with the local
router.
Consider only (synchronized) routes with no AS loops and a valid next hop, and then:
1.Prefer highest weight (local to router).
2.Prefer highest local preference (global within AS).
乐档网,我分享,我快乐!
http://www.ledlh.cn/
3.Prefer route originated by the local router (next hop = 0.0.0.0).
4.Prefer shortest AS path.
5.Prefer lowest origin code (IGP
6.Prefer lowest MED (exchanged between autonomous systems).
7.Prefer EBGP path over IBGP path. AD value
metric
20=eBGP 200=iBGP
8.Prefer the path through the closest IGP neighbor.
9.Prefer oldest route for EBGP paths.
10.Prefer the path with the lowest neighbor BGP router ID.
11.Prefer the path with the lowest neighbor router-id IP address.
选路工具
neighbor X.X.X.X
route-map(ACL | Prefix-list)
out / in
LAB3:MED(实验目的:整个 AS 200 都从下面链路走)
本地修改 MED 属性,建议对方 AS 从特定路径进入本地 AS,由于本地控制不了对方,所以是
建议。
MED 以 metric 值这种方式体现,越小越好。通告给对方的,影响对方如何访问我方网络。
这个是非传递的属性
乐档网,我分享,我快乐!
http://www.ledlh.cn/
特征:
1.MED 的取值越小越好
2.只发送给 eBGP 邻居,建议对方如何离开他们的 AS 来访问我们的 AS
3.是一种可选的非传递的属性
4.CISCO 路由器上 MED 默认值=0
5.BGP 默认情况下,只比较来自同一个 AS 的 MED
step1:定义路由。(通过 prifex-list)
R2#
ip prefix-list SUB_110 permit 110.1.0.0/16
Step2:通过 route-map 控制 BGP 路由的属性
分区 CCNP 的第 2 页
R2#
route-map SET_MED permit 10
match ip add prefix-list SUB_110
set metric 100
乐档网,我分享,我快乐!
http://www.ledlh.cn/
route-map SET_MED permit 20
Step3:对邻居调用 route-map 策略
R2#
router bgp 100
neighbor 24.0.0.4 route-map SET_MED out
LAB4:Origin type
step1:定义路由。(通过 prifex-list)
R1# ip prefix-list R_110 permit 110.1.0.0/16Step2:通过 route-map 控制 BGP 路由的属
性
R1# route-map TO_AS200 permit 10
match ip add prefix-list R_110
set origin incomplete
route-map TO_AS200 permit 20
Step3:对邻居调用 route-map 策略
R1# router bgp 100
neighbor 13.0.0.3 route-map TO_AS200 out
乐档网,我分享,我快乐!
http://www.ledlh.cn/
LAB4:通过 AS-path 去影响 BGP 选路
(实验目的:整个 AS 200 都从下面链路走)
在 R1 和 R3 之间,增加一个虚拟的 AS 150
Step1:定义路由
R4# ip prefix-list R_110 permit 110.1.0.0/16Step2:控制属性
R4# route-map Add_AS permit 10
match ip add prefix-list R_110
set as-path prepend 150
route-map Add_AS permit 20
Step3:调用策略
R4# router bgp 200
nei 24.0.0.2 route-map Add_AS in
------影响自己的在 R2 上软清,等于向 R4 重新发送了
一条跟新
在 R4 上看效果(注意后面 AS 号的顺序)
R4# sh ip bgp
乐档网,我分享,我快乐!
http://www.ledlh.cn/
R3 和 R5# sh ip bgp 看有几条.为什么
思考在 R2 的 out 方向上做有是什么效果?
1.如果在本端(R3)in 方向做增加 AS 号,则条目是先到 AS 150
再到对方 AS
再去后继 AS
2.如果在对端(R2)out 方向做增加 AS 号,则条目是先到对方 AS
在到 AS 150 再去后继 AS
LAB5:local preference
只在出口路由器(R4)上做.
我作为控制出口的网管,建议内部的大家出去的走法特征:
1.越大越好 默认值=100
2.只告诉给 iBGP 邻居,用于建议他们如何离开本 AS
3.是公认的,自决的,只会在本 AS 传递
Step1:定义路由
R4# ip prefix-list R_110 permit 110.1.0.0/16Step2:控制属性
R4# route-map Add_AS permit 10
match ip add prefix-list R_110
乐档网,我分享,我快乐!
http://www.ledlh.cn/
set as-path prepend 150
分区 CCNP 的第 3 页
set local-preference 200
---------添加了一句 route-map Add_AS permit 20
Step3:调用策略
R4# router bgp 200
nei 24.0.0.2 route-map Add_AS in
在 R3/R4/R5 上看效果
在 R1 上软清,看各有几条路由条目
分析结果
LAB6:Weight -----------cisco 私有
在 R4 上做
只影响自己,不发送给任何 peer
特征:
1.私有的
2.学习来的路由器默认值=0
本地起源的=32768
越大越好
3.不发送给任何 BGP peer,不影响邻居选路,只影响自己 R3# router bgp 200
乐档网,我分享,我快乐!
http://www.ledlh.cn/
nei 13.0.0.1 weighbor 3000
分析
对 weight 进行粒度更小的控制(基于路由条目)
R3# route-map SET_WEI per 10
match ip prefix-list R_110
set weight 3500
route-map SET_WEI per 20
R3# router bgp 200
nei 13.0.0.1 route-map SET_WEI in
思考 R5 如何选路
分区 CCNP 的第 4 页
分区 CCNP 的第 5 页
乐档网-提供各行各业及小学、初中、高中、高等教育、工程科技、工程管理、
职场、商业合同等文档范文下载,所有范文免费分享,是您下载范文的首选网
乐档网,我分享,我快乐!
http://www.ledlh.cn/
站。
乐档网 http://www.ledlh.cn/
Download