Download presentation
Presentation is loading. Please wait.
Published byMeagan Fisher Modified over 8 years ago
1
Basic Border Gateway Protocol Path Manipulation Using Route Maps © 2003, Cisco Systems, Inc. All rights reserved. 1
2
BSCI 2.0—7-2 Objectives Upon completing this lesson, you will be able to: Use route maps to set local preference ( 本地优先 ) Use route maps to set multi-exit discriminator (MED)
3
© 2003, Cisco Systems, Inc. All rights reserved. BSCI 2.0—7-3 BGP is Designed to Implement Policy Routing BGP is designed for manipulating routing pathways.
4
© 2003, Cisco Systems, Inc. All rights reserved. BSCI 2.0—7-4 Route Selection Decision Process Consider only (synchronized) routes with no AS loops and a valid next hop, and then: Prefer highest weight (local to router, 权重高.) Prefer highest local preference (global within AS, 本地优先高 ) Prefer route originated by the local router ( 如果到目的有多条路由,且具有相同本地优先 值,那么优选由本路由器始发的路由。 ) Prefer shortest AS path( 最短 AS 路径.) Prefer lowest origin code ( 如果 AS 路径长度相同,优选最低的起源号码 ) Prefer lowest MED ( 如果所有起源号码相同, 那么用 MED 值低的优选路径 MED 是其他 AS 发过 来的.) Prefer EBGP path over IBGP path.( 如果 MED 值相同,优选外部路径 EBGP ,再选内部路径 IBGP) Prefer the path through the closest IGP neighbor( 如果关闭了同步,并只有内部路径,那 么优选通过最近 IGP 邻居的路径;即到 BGP 下一跳的最短路径。 ) Prefer oldest route for EBGP paths( 对于 EBGP 路径,选择最旧的路由,以减少路由时 up 时 down 的影响。 ) Prefer the path with the lowest neighbor BGP router ID( 如果上述均相同,用最低的的邻 居路由器 ID 号优选路由 )
5
© 2003, Cisco Systems, Inc. All rights reserved. BSCI 2.0—7-5 BGP Local Preference bgp default local-preference value Router(config-router)# Changes the default local preference value \\ 直接修改路由器的本地优先值, 路由器缺省的本地优先值为 100. All routes advertised to an IBGP neighbor are set to the value specified using this command( 在 AS 内可传递的, 不 会传给 EBGP 邻居.) Local preference is used in the following ways: Within an AS between IBGP speakers (AS 内传递.) Used to determine the best pathway to leave the AS to reach an outside network Set to 100 by default; higher values are preferred
6
© 2003, Cisco Systems, Inc. All rights reserved. BSCI 2.0—7-6 Setting a Default Local Preference All routers are running BGP. Router B is announcing local preference of 500 for all routes. Router A is announcing local preference of 200 for all routes. BGP path selection chooses step 2 for all routes causing all traffic to exit through router B, which was not the intention.
7
© 2003, Cisco Systems, Inc. All rights reserved. BSCI 2.0—7-7 Route Map for Router A Router A’s Configuration: router bgp 65001 neighbor 2.2.2.2 remote-as 65001 neighbor 3.3.3.3 remote-as 65001 neighbor 2.2.2.2 remote-as 65001 update-source loopback0 neighbor 3.3.3.3 remote-as 65001 update-source loopback0 neighbor 192.168.28.1 remote-as 65002 neighbor 192.168.28.1 route-map local_pref in ! route-map local_pref permit 10 match ip address 65 set local-preference 400 route-map local_pref permit 20 access-list 65 permit 172.30.0.0 0.0.255.255 \\ 建议不要直接配置本地优先, 可配合 ROUTE-MAP 来控制特定的路由.
8
© 2003, Cisco Systems, Inc. All rights reserved. BSCI 2.0—7-8 Local Preference Learned by Router C RouterC# show ip bgp BGP table version is 7, local router ID is 3.3.3.3 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path * i172.16.0.0 172.20.50.1 100 0 65005 65004 65003 i *>i 192.168.28.1 100 0 65002 65003 i *>i172.24.0.0 172.20.50.1 100 0 65005 i * i 192.168.28.1 100 0 65002 65003 65004 65005 i * i172.30.0.0 172.20.50.1 100 0 65005 65004 i *>i 192.168.28.1 400 0 65002 65003 65004i Best (>) pathways for networks 172.16.0.0/16 and 172.24.0.0/16 have not changed. Best (>) pathway for network 172.30.0.0 has changed to a new next hop of 192.168.28.1 due to the next hop of 192.168.28.1 having a higher local preference, 400. In AS 65001, the percentage of traffic going to 172.24.0.0 is 30%, 172.30.0.0 is 20%, and 172.16.0.0 is 10%. 30% of all traffic will go to the next hop of 172.20.50.1 (AS 65005), and 30% of all traffic will go to the next hop of 192.168.28.1 (AS 65002).
9
© 2003, Cisco Systems, Inc. All rights reserved. BSCI 2.0—7-9 BGP Multi-Exit Discriminator: Inbound Metric default-metric number Router(config-router)# MED is considered the metric of BGP. All routes advertised to an EBGP neighbor are set to the value specified using this command. MED is used when multiple pathways exist between two Autonomous Systems( 有多条路径离开 AS 时使用,MED 小的优先.) A lower MED value is preferred. The default setting for Cisco is MED = 0. The metric is nontransitive. ( 非传递的 ) By default, MED is shared only between two Autonomous Systems that have multiple EBGP connections with each other. 两个 AS 间有多条链路时.
10
© 2003, Cisco Systems, Inc. All rights reserved. BSCI 2.0—7-10 BGP Using Default MED Router B is announcing a MED of 99 for routes originating in AS 65001. Router A is announcing a MED of 1001 for routes originating in AS 65001. 如果 isp65004 没有其他的策略, 65004 将要求 AS65001 选择路由器 Y 做 为最佳的出口。 because of step 6—prefer lowest MED (from other AS).
11
© 2003, Cisco Systems, Inc. All rights reserved. BSCI 2.0—7-11 BGP using Route Maps and MED
12
© 2003, Cisco Systems, Inc. All rights reserved. BSCI 2.0—7-12 Route Map for Router A Router A’s Configuration: router bgp 65001 neighbor 2.2.2.2 remote-as 65001 neighbor 3.3.3.3 remote-as 65001 neighbor 2.2.2.2 update-source loopback0 neighbor 3.3.3.3 update-source loopback0 neighbor 192.168.28.1 remote-as 65004 neighbor 192.168.28.1 route-map med_65004 out ! route-map med_65004 permit 10 match ip address 66 set metric 100 route-map med_65004 permit 100 set metric 200 access-list 66 permit 192.168.25.0.0 0.0.0.255 access-list 66 permit 192.168.26.0.0 0.0.0.255 \\ 与 ROUTER-MAP 配合使用, 可以灵活控制流量.
13
© 2003, Cisco Systems, Inc. All rights reserved. BSCI 2.0—7-13 Route Map for Router B Router B’s Configuration: router bgp 65001 neighbor 1.1.1.1 remote-as 65001 neighbor 3.3.3.3 remote-as 65001 neighbor 1.1.1.1 update-source loopback0 neighbor 3.3.3.3 update-source loopback0 neighbor 172.20.50.1 remote-as 65004 neighbor 172.20.50.1 route-map med_65004 out ! route-map med_65004 permit 10 match ip address 66 set metric 100 route-map med_65004 permit 100 set metric 200 ! access-list 66 permit 192.168.24.0.0 0.0.0.255
14
© 2003, Cisco Systems, Inc. All rights reserved. BSCI 2.0—7-14 MED Learned by Router Z RouterZ# show ip bgp BGP table version is 7, local router ID is 122.30.1.1 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *>i192.168.24.0 172.20.50.2 100 100 0 65001 i * i 192.168.28.2 200 100 0 65001 i * i192.168.25.0 172.20.50.2 200 100 0 65001 i *>i 192.168.28.2 100 100 0 65001 i * i192.168.26.0 172.20.50.2 200 100 0 65001 i *>i 192.168.28.2 100 100 0 65001 i Examine the networks learned from AS 65001 on Router Z in AS 65004. For all networks: Weight is equal (0); local preference is equal (100); routes are not originated in this AS; AS path is equal (65001); origin code is equal (i). 192.168.24.0 has a lower metric (MED) through 172.20.50.2 (100) than 192.168.28.2 (200). 192.168.25.0 has a lower metric (MED) through 192.168.28.2 (100) than 172.20.50.2 (200). 192.168.26.0 has a lower metric (MED) through 192.168.28.2 (100) than 172.20.50.2 (200).
15
© 2003, Cisco Systems, Inc. All rights reserved. BSCI 2.0—7-15 本地优先 : 对离开自己的流量有效. 相对而言, 是优先考虑的. MED: 由外部 EBGP 注入的, 是 AS 外的管理员想影响到此 AS 而 设置的. 以对离开我的流量进行有效控制. 如上例的 65004- 65001.
16
© 2003, Cisco Systems, Inc. All rights reserved. BSCI 2.0—7-16 Local Preference? 路由器 C 分别到 65003,65004,65005 的最佳路径是什么 ?
17
© 2003, Cisco Systems, Inc. All rights reserved. BSCI 2.0—7-17 Default Settings on Router C RouterC# show ip bgp BGP table version is 7, local router ID is 3.3.3.3 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path * i172.16.0.0 172.20.50.1 100 0 65005 65004 65003 i *>i 192.168.28.1 100 0 65002 65003 i *>i172.24.0.0 172.20.50.1 100 0 65005 i * i 192.168.28.1 100 0 65002 65003 65004 65005 i *>i172.30.0.0 172.20.50.1 100 0 65005 65004 i * i 192.168.28.1 100 0 65002 65003 65004i By default, BGP selects the shortest AS path as the best (>) pathway.
18
© 2003, Cisco Systems, Inc. All rights reserved. BSCI 2.0—7-18 请完成实验 : local-pref med local-pref + Route Map med + Route Map
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.