[BGP] best path selection_2
2. shortest AS path
AS-Path는 해당 네트워크까지 가는 경로 상에 있는 AS 주소들을 기록해 놓는 속성이다. 이때, 해당 네트워크 정보가 소속된 AS 주소는 가장 오른쪽에 기록되며, AS와 AS 간에 라우팅 업데이트가 되면서 누적되는 AS 주소는 왼쪽 방향으로 차례대로 기록된다. 그리고 서로 다른 neighbor로부터 동일한 BGP 정보를 수신한다면, AS-Path 주소에 짧게 기록된 정보가 선출된다.
*A:R6>config>router# show router policy "upper" entry 10 from protocol static tag 100 exit to protocol bgp exit action accept as-path-prepend 500 1 origin igp next-hop 30.1.1.3 exit exit |
*A:R7>config>router# show router policy "upper" entry 10 from protocol static tag 100 exit to protocol bgp exit action accept as-path-prepend 500 1 origin igp next-hop 30.1.1.4 exit exit |
*A:R5>config>router# show router bgp routes 20.1.11.0/24 =============================================================================== BGP Router ID:5.5.5.5 AS:4766 Local AS:4766 =============================================================================== Legend - Status codes : u - used, s - suppressed, h - history, d - decayed, * - valid l - leaked, x - stale, > - best, b - backup, p - purge Origin codes : i - IGP, e - EGP, ? - incomplete
=============================================================================== BGP IPv4 Routes =============================================================================== Flag Network LocalPref MED Nexthop (Router) Path-Id Label As-Path ------------------------------------------------------------------------------- u*>i 20.1.11.0/24 100 None 30.1.1.3 None - 500 *i 20.1.11.0/24 None None 7.7.7.7 None - 4768 500 ------------------------------------------------------------------------------- Routes : 2 =============================================================================== |
20.1.11.0/24 NH 30.1.1.3의 경로가 best 경로로 나옴을 확인할 수 있다.
정리하자면 AS가 같아서 No As-Path가 나오는 건데
다른 AS로 부터 받은 경로는 AS-Path에 찍히기 때문에 Ibgp로 받은 정보가 더 우선시 되는 것이다.
또한 20.1.11.0/24 NH 7.7.7.7의 경로는 R7에서 20.1.11.0/24 NH 30.1.1.4로 BGP 재분배를 하였지만,
R7의 system IP로 나온 것으로 보아, ebgp간 받은 정보는 해당 라우터의 neighbor IP가 찍힘을 알 수 있다.
*A:R5>config>router# show router bgp routes 20.1.11.0/24 detail =============================================================================== BGP Router ID:5.5.5.5 AS:4766 Local AS:4766 =============================================================================== Legend - Status codes : u - used, s - suppressed, h - history, d - decayed, * - valid l - leaked, x - stale, > - best, b - backup, p - purge Origin codes : i - IGP, e - EGP, ? - incomplete
=============================================================================== BGP IPv4 Routes =============================================================================== Original Attributes
Network : 20.1.11.0/24 Nexthop : 30.1.1.3 Path Id : None From : 6.6.6.6 Res. Nexthop : 10.1.23.1 Local Pref. : 100 Interface Name : Te1/1/3 Aggregator AS : None Aggregator : None Atomic Aggr. : Not Atomic MED : None AIGP Metric : None Connector : None Community : No Community Members Cluster : No Cluster Members Originator Id : None Peer Router Id : 6.6.6.6 Fwd Class : None Priority : None Flags : Used Valid Best IGP Route Source : Internal AS-Path : 500 Route Tag : 0 Neighbor-AS : 500 Orig Validation: NotFound Source Class : 0 Dest Class : 0 Add Paths Send : Default Last Modified : 02h07m47s
Modified Attributes
Network : 20.1.11.0/24 Nexthop : 30.1.1.3 Path Id : None From : 6.6.6.6 Res. Nexthop : 10.1.23.1 Local Pref. : 100 Interface Name : Te1/1/3 Aggregator AS : None Aggregator : None Atomic Aggr. : Not Atomic MED : None AIGP Metric : None Connector : None Community : No Community Members Cluster : No Cluster Members Originator Id : None Peer Router Id : 6.6.6.6 Fwd Class : None Priority : None Flags : Used Valid Best IGP Route Source : Internal AS-Path : 500 Route Tag : 0 Neighbor-AS : 500 Orig Validation: NotFound Source Class : 0 Dest Class : 0 Add Paths Send : Default Last Modified : 02h07m47s
------------------------------------------------------------------------------- Original Attributes
Network : 20.1.11.0/24 Nexthop : 7.7.7.7 Path Id : None From : 7.7.7.7 Res. Nexthop : 10.1.23.1 Local Pref. : n/a Interface Name : Te1/1/3 Aggregator AS : None Aggregator : None Atomic Aggr. : Not Atomic MED : None AIGP Metric : None Connector : None Community : No Community Members Cluster : No Cluster Members Originator Id : None Peer Router Id : 7.7.7.7 Fwd Class : None Priority : None Flags : Valid IGP TieBreakReason : ASPathLen Route Source : External AS-Path : 4768 500 Route Tag : 0 Neighbor-AS : 4768 Orig Validation: NotFound Source Class : 0 Dest Class : 0 Add Paths Send : Default Last Modified : 00h02m41s
Modified Attributes
Network : 20.1.11.0/24 Nexthop : 7.7.7.7 Path Id : None From : 7.7.7.7 Res. Nexthop : 10.1.23.1 Local Pref. : None Interface Name : Te1/1/3 Aggregator AS : None Aggregator : None Atomic Aggr. : Not Atomic MED : None AIGP Metric : None Connector : None Community : No Community Members Cluster : No Cluster Members Originator Id : None Peer Router Id : 7.7.7.7 Fwd Class : None Priority : None Flags : Valid IGP TieBreakReason : ASPathLen Route Source : External AS-Path : 4768 500 Route Tag : 0 Neighbor-AS : 4768 Orig Validation: NotFound Source Class : 0 Dest Class : 0 Add Paths Send : Default Last Modified : 00h02m43s
------------------------------------------------------------------------------- ------------------------------------------------------------------------------- Routes : 2
|
ㅁ 1번, 2번 항목 비교
R1에서 local-preference와 as-path 경로 우선순위를 살펴보면,
R2에서의 local-preference과 R5의 as path 우선인 20.1.11.0/24 경로에 대해서
R1에서 bgp 경로 확인 결과 local-preference가 우선임을 확인할 수 있다.
A:R1# show router bgp routes 20.1.11.0/24 =============================================================================== BGP Router ID:1.1.1.1 AS:4766 Local AS:4766 =============================================================================== Legend - Status codes : u - used, s - suppressed, h - history, d - decayed, * - valid l - leaked, x - stale, > - best, b - backup, p - purge Origin codes : i - IGP, e - EGP, ? - incomplete
=============================================================================== BGP IPv4 Routes =============================================================================== Flag Network LocalPref MED Nexthop (Router) Path-Id Label As-Path ------------------------------------------------------------------------------- u*>i 20.1.11.0/24 200 None 30.1.1.2 None - No As-Path *i 20.1.11.0/24 100 None 30.1.1.3 None - No As-Path ------------------------------------------------------------------------------- Routes : 2 =============================================================================== |
*A:R2>show>router>bgp# show router bgp routes 20.1.11.0/24 detail =============================================================================== BGP Router ID:2.2.2.2 AS:4766 Local AS:4766 =============================================================================== Legend - Status codes : u - used, s - suppressed, h - history, d - decayed, * - valid l - leaked, x - stale, > - best, b - backup, p - purge Origin codes : i - IGP, e - EGP, ? - incomplete
=============================================================================== BGP IPv4 Routes =============================================================================== Original Attributes
Network : 20.1.11.0/24 Nexthop : 30.1.1.2 Path Id : None From : 4.4.4.4 Res. Nexthop : 10.1.12.2 Local Pref. : 200 Interface Name : Te1/1/1 Aggregator AS : None Aggregator : None Atomic Aggr. : Not Atomic MED : None AIGP Metric : None Connector : None Community : No Community Members Cluster : No Cluster Members Originator Id : None Peer Router Id : 4.4.4.4 Fwd Class : None Priority : None Flags : Used Valid Best IGP Route Source : Internal AS-Path : No As-Path Route Tag : 0 Neighbor-AS : N/A Orig Validation: NotFound Source Class : 0 Dest Class : 0 Add Paths Send : Default Last Modified : 00h00m04s
Modified Attributes
Network : 20.1.11.0/24 Nexthop : 30.1.1.2 Path Id : None From : 4.4.4.4 Res. Nexthop : 10.1.12.2 Local Pref. : 200 Interface Name : Te1/1/1 Aggregator AS : None Aggregator : None Atomic Aggr. : Not Atomic MED : None AIGP Metric : None Connector : None Community : No Community Members Cluster : No Cluster Members Originator Id : None Peer Router Id : 4.4.4.4 Fwd Class : None Priority : None Flags : Used Valid Best IGP Route Source : Internal AS-Path : No As-Path Route Tag : 0 Neighbor-AS : N/A Orig Validation: NotFound Source Class : 0 Dest Class : 0 Add Paths Send : Default Last Modified : 00h00m04s
------------------------------------------------------------------------------- Original Attributes
Network : 20.1.11.0/24 Nexthop : 30.1.1.1 Path Id : None From : 3.3.3.3 Res. Nexthop : 10.1.12.2 Local Pref. : 100 Interface Name : Te1/1/1 Aggregator AS : None Aggregator : None Atomic Aggr. : Not Atomic MED : None AIGP Metric : None Connector : None Community : No Community Members Cluster : No Cluster Members Originator Id : None Peer Router Id : 3.3.3.3 Fwd Class : None Priority : None Flags : Valid IGP TieBreakReason : LocalPref Route Source : Internal AS-Path : No As-Path Route Tag : 0 Neighbor-AS : N/A Orig Validation: NotFound Source Class : 0 Dest Class : 0 Add Paths Send : Default Last Modified : 00h03m34s
Modified Attributes
Network : 20.1.11.0/24 Nexthop : 30.1.1.1 Path Id : None From : 3.3.3.3 Res. Nexthop : 10.1.12.2 Local Pref. : 100 Interface Name : Te1/1/1 Aggregator AS : None Aggregator : None Atomic Aggr. : Not Atomic MED : None AIGP Metric : None Connector : None Community : No Community Members Cluster : No Cluster Members Originator Id : None Peer Router Id : 3.3.3.3 Fwd Class : None Priority : None Flags : Valid IGP TieBreakReason : LocalPref Route Source : Internal AS-Path : No As-Path Route Tag : 0 Neighbor-AS : N/A Orig Validation: NotFound Source Class : 0 Dest Class : 0 Add Paths Send : Default Last Modified : 00h03m36s
------------------------------------------------------------------------------- ------------------------------------------------------------------------------- Routes : 2 |
A:R5>config>router# show router bgp routes 20.1.11.0/24 detail =============================================================================== BGP Router ID:5.5.5.5 AS:4766 Local AS:4766 =============================================================================== Legend - Status codes : u - used, s - suppressed, h - history, d - decayed, * - valid l - leaked, x - stale, > - best, b - backup, p - purge Origin codes : i - IGP, e - EGP, ? - incomplete
=============================================================================== BGP IPv4 Routes =============================================================================== Original Attributes
Network : 20.1.11.0/24 Nexthop : 30.1.1.3 Path Id : None From : 6.6.6.6 Res. Nexthop : 10.1.23.1 Local Pref. : 100 Interface Name : Te1/1/3 Aggregator AS : None Aggregator : None Atomic Aggr. : Not Atomic MED : None AIGP Metric : None Connector : None Community : No Community Members Cluster : No Cluster Members Originator Id : None Peer Router Id : 6.6.6.6 Fwd Class : None Priority : None Flags : Used Valid Best IGP Route Source : Internal AS-Path : No As-Path Route Tag : 0 Neighbor-AS : N/A Orig Validation: NotFound Source Class : 0 Dest Class : 0 Add Paths Send : Default Last Modified : 00h02m31s
Modified Attributes
Network : 20.1.11.0/24 Nexthop : 30.1.1.3 Path Id : None From : 6.6.6.6 Res. Nexthop : 10.1.23.1 Local Pref. : 100 Interface Name : Te1/1/3 Aggregator AS : None Aggregator : None Atomic Aggr. : Not Atomic MED : None AIGP Metric : None Connector : None Community : No Community Members Cluster : No Cluster Members Originator Id : None Peer Router Id : 6.6.6.6 Fwd Class : None Priority : None Flags : Used Valid Best IGP Route Source : Internal AS-Path : No As-Path Route Tag : 0 Neighbor-AS : N/A Orig Validation: NotFound Source Class : 0 Dest Class : 0 Add Paths Send : Default Last Modified : 00h02m31s
------------------------------------------------------------------------------- Original Attributes
Network : 20.1.11.0/24 Nexthop : 30.1.1.4 Path Id : None From : 7.7.7.7 Res. Nexthop : 10.1.23.1 Local Pref. : 100 Interface Name : Te1/1/3 Aggregator AS : None Aggregator : None Atomic Aggr. : Not Atomic MED : None AIGP Metric : None Connector : None Community : No Community Members Cluster : No Cluster Members Originator Id : None Peer Router Id : 7.7.7.7 Fwd Class : None Priority : None Flags : Valid IGP TieBreakReason : ASPathLen Route Source : Internal AS-Path : 500 Route Tag : 0 Neighbor-AS : 500 Orig Validation: NotFound Source Class : 0 Dest Class : 0 Add Paths Send : Default Last Modified : 00h00m06s
Modified Attributes
Network : 20.1.11.0/24 Nexthop : 30.1.1.4 Path Id : None From : 7.7.7.7 Res. Nexthop : 10.1.23.1 Local Pref. : 100 Interface Name : Te1/1/3 Aggregator AS : None Aggregator : None Atomic Aggr. : Not Atomic MED : None AIGP Metric : None Connector : None Community : No Community Members Cluster : No Cluster Members Originator Id : None Peer Router Id : 7.7.7.7 Fwd Class : None Priority : None Flags : Valid IGP TieBreakReason : ASPathLen Route Source : Internal AS-Path : 500 Route Tag : 0 Neighbor-AS : 500 Orig Validation: NotFound Source Class : 0 Dest Class : 0 Add Paths Send : Default Last Modified : 00h00m10s
------------------------------------------------------------------------------- ------------------------------------------------------------------------------- Routes : 2 |
local-preference가 우선임을 알 수 있다.
*A:R1>config>router# show router bgp routes 20.1.11.0/24 =============================================================================== BGP Router ID:1.1.1.1 AS:4766 Local AS:4766 =============================================================================== Legend - Status codes : u - used, s - suppressed, h - history, d - decayed, * - valid l - leaked, x - stale, > - best, b - backup, p - purge Origin codes : i - IGP, e - EGP, ? - incomplete
=============================================================================== BGP IPv4 Routes =============================================================================== Flag Network LocalPref MED Nexthop (Router) Path-Id Label As-Path ------------------------------------------------------------------------------- u*>i 20.1.11.0/24 200 None 30.1.1.2 None - No As-Path *i 20.1.11.0/24 100 None 30.1.1.3 None - 500 ------------------------------------------------------------------------------- Routes : 2 ===============================================================================
*A:R1>config>router# show router bgp routes 20.1.11.0/24 detail =============================================================================== BGP Router ID:1.1.1.1 AS:4766 Local AS:4766 =============================================================================== Legend - Status codes : u - used, s - suppressed, h - history, d - decayed, * - valid l - leaked, x - stale, > - best, b - backup, p - purge Origin codes : i - IGP, e - EGP, ? - incomplete
=============================================================================== BGP IPv4 Routes =============================================================================== Original Attributes
Network : 20.1.11.0/24 Nexthop : 30.1.1.2 Path Id : None From : 2.2.2.2 Res. Nexthop : 10.1.11.2 Local Pref. : 200 Interface Name : Te1/1/1 Aggregator AS : None Aggregator : None Atomic Aggr. : Not Atomic MED : None AIGP Metric : None Connector : None Community : No Community Members Cluster : 2.2.2.2 Originator Id : 4.4.4.4 Peer Router Id : 2.2.2.2 Fwd Class : None Priority : None Flags : Used Valid Best IGP Route Source : Internal AS-Path : No As-Path Route Tag : 0 Neighbor-AS : N/A Orig Validation: NotFound Source Class : 0 Dest Class : 0 Add Paths Send : Default Last Modified : 00h03m20s
Modified Attributes
Network : 20.1.11.0/24 Nexthop : 30.1.1.2 Path Id : None From : 2.2.2.2 Res. Nexthop : 10.1.11.2 Local Pref. : 200 Interface Name : Te1/1/1 Aggregator AS : None Aggregator : None Atomic Aggr. : Not Atomic MED : None AIGP Metric : None Connector : None Community : No Community Members Cluster : 2.2.2.2 Originator Id : 4.4.4.4 Peer Router Id : 2.2.2.2 Fwd Class : None Priority : None Flags : Used Valid Best IGP Route Source : Internal AS-Path : No As-Path Route Tag : 0 Neighbor-AS : N/A Orig Validation: NotFound Source Class : 0 Dest Class : 0 Add Paths Send : Default Last Modified : 00h03m20s
------------------------------------------------------------------------------- Original Attributes
Network : 20.1.11.0/24 Nexthop : 30.1.1.3 Path Id : None From : 5.5.5.5 Res. Nexthop : 10.1.11.2 Local Pref. : 100 Interface Name : Te1/1/1 Aggregator AS : None Aggregator : None Atomic Aggr. : Not Atomic MED : None AIGP Metric : None Connector : None Community : No Community Members Cluster : 5.5.5.5 Originator Id : 6.6.6.6 Peer Router Id : 5.5.5.5 Fwd Class : None Priority : None Flags : Valid IGP TieBreakReason : LocalPref Route Source : Internal AS-Path : 500 Route Tag : 0 Neighbor-AS : 500 Orig Validation: NotFound Source Class : 0 Dest Class : 0 Add Paths Send : Default Last Modified : 00h12m20s
Modified Attributes
Network : 20.1.11.0/24 Nexthop : 30.1.1.3 Path Id : None From : 5.5.5.5 Res. Nexthop : 10.1.11.2 Local Pref. : 100 Interface Name : Te1/1/1 Aggregator AS : None Aggregator : None Atomic Aggr. : Not Atomic MED : None AIGP Metric : None Connector : None Community : No Community Members Cluster : 5.5.5.5 Originator Id : 6.6.6.6 Peer Router Id : 5.5.5.5 Fwd Class : None Priority : None Flags : Valid IGP TieBreakReason : LocalPref Route Source : Internal AS-Path : 500 Route Tag : 0 Neighbor-AS : 500 Orig Validation: NotFound Source Class : 0 Dest Class : 0 Add Paths Send : Default Last Modified : 00h12m20s
------------------------------------------------------------------------------- ------------------------------------------------------------------------------- Routes : 2 |