第三条
:LP值用于as多出口,离开as最佳的路由
查看r4路由表:
<R4>dis bgp routing-table
Total Number of Routes: 11
BGP Local router ID is 4.4.4.4
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 1.1.1.1/32 2.2.2.2 0 100 0 100i
* i 3.3.3.3 0 100 0 100i
i 2.2.2.2/32 2.2.2.2 0 100 0 i
* i 3.3.3.3 3124 100 0 ?
* i 3.3.3.3/32 2.2.2.2 3124 100 0 ?
i 3.3.3.3 0 100 0 i
*> 4.4.4.4/32 0.0.0.0 0 0 i
* i 2.2.2.2 1562 100 0 ?
* i 3.3.3.3 1562 100 0 ?
* i 24.24.24.0/24 3.3.3.3 3124 100 0 ?
* i 34.34.34.0/24 2.2.2.2 3124 100 0 ?
R4上的路由优选的ROUTER ID最小的,见第十二条!
LP值默认为100,无比较价值,修改r2的lp值
[R2-bgp]default local-preference 2222
<R4>dis bgp routing-table
Total Number of Routes: 11
BGP Local router ID is 4.4.4.4
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 1.1.1.1/32 2.2.2.2 0 2222 0 100i
* i 3.3.3.3 0 100 0 100i
i 2.2.2.2/32 2.2.2.2 0 2222 0 i
* i 3.3.3.3 3124 100 0 ?
* i 3.3.3.3/32 2.2.2.2 3124 2222 0 ?
i 3.3.3.3 0 100 0 i
*> 4.4.4.4/32 0.0.0.0 0 0 i
* i 2.2.2.2 1562 2222 0 ?
* i 3.3.3.3 1562 100 0 ?
* i 24.24.24.0/24 3.3.3.3 3124 100 0 ?
* i 34.34.34.0/24 2.2.2.2 3124 2222 0 ?
来在R2的路由lp值都变成了2222,优选lp值大的路由离开as
在R4上加入三条换回口并且宣告
[R4-bgp]network 40.1.1.1 32
[R4-bgp]network 40.2.2.2 32
[R4-bgp]network 40.3.3.3 32
在R3上做聚合aggregate 40.0.0.0 255.0.0.0
查看R3的路由表:[R3]dis ip routing-table 40.0.0.0
Routing Table : Public
Summary Count : 1
Destination/Mask Proto Pre Cost NextHop Interface
40.0.0.0/8 BGP 130 0 127.0.0.1 NULL0
优先级只有130,普通的bgp路由优先级都是255,优选优先级数值小的路由!
为了看到实验现象,在R2上使用路由策略,是aspash变长
[R2]dis acl 2000
Basic ACL 2000, named -none-, 1 rule,
ACL's step is 5
rule 0 permit source 4.4.4.4 0 (8 times matched) 使用acl匹配4.4.4.4/32的路由
[R2]dis cu conf ro
#
route-policy as permit node 10
if-match acl 2000
apply as-path 200 300 400
route-policy as permit node 20使用路由策略改变aspash的属性
#
peer 12.12.12.1 route-policy as export
peer 10.0.12.1 route-policy as export将策略是以在出方向上
查看R1上的4.4.4.4路由:
*> 4.4.4.4/32 13.13.13.3 1562 0 200?
* 12.12.12.2 1562 0 200 200
300 400?
* 10.0.12.2 1562 0 200 200
300 400?
优选了来自R3的4.4.4.4,因为aspash最短!
第四条
实验方法和思想与第五条类似,不罗嗦重复
med其实和igp中的metric类似,比如ospf的cost,用于一个as多入口选路,选择med小的路由,注意:仅仅在两个as之间传播
将R3的med改的很小:[R3-bgp]default med 1
查看R1bgp路由表:<R1>dis bgp routing-table
Total Number of Routes: 13
BGP Local router ID is 1.1.1.1
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 1.1.1.1/32 0.0.0.0 0 0 i
*> 2.2.2.2/32 10.0.12.2 0 0 200i
* 13.13.13.3 1 0 200?
* 12.12.12.2 0 0 200i
*> 3.3.3.3/32 13.13.13.3 1 0 200i
* 12.12.12.2 3124 0 200?
* 10.0.12.2 3124 0 200?
*> 4.4.4.4/32 13.13.13.3 1 0 200?
* 12.12.12.2 1562 0 200?
* 10.0.12.2 1562 0 200?
*> 24.24.24.0/24 13.13.13.3 1 0 200?
*> 34.34.34.0/24 10.0.12.2 3124 0 200?
* 12.12.12.2 3124 0 200?
:在R3上改变下cost,R4有限R3来的路由
[R1]dis bgp r
Total Number of Routes: 13
BGP Local router ID is 1.1.1.1
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 1.1.1.1/32 0.0.0.0 0 0 i
*> 2.2.2.2/32 10.0.12.2 0 0 200i
* 13.13.13.3 1563 0 200?
* 12.12.12.2 0 0 200i
*> 3.3.3.3/32 13.13.13.3 0 0 200i
* 12.12.12.2 3124 0 200?
* 10.0.12.2 3124 0 200?
*> 4.4.4.4/32 13.13.13.3 1 0 200?
* 12.12.12.2 1562 0 200?
* 10.0.12.2 1562 0 200?
*> 24.24.24.0/24 13.13.13.3 1563 0 200?
*> 34.34.34.0/24 10.0.12.2 3124 0 200?
* 12.12.12.2 3124 0 200?
剩下的几条,回头再写