Local Preference
Local Preference는 iBGP 내부에서만 유효한 속성으로 AS 외부로 나가기 위한 경로 선호도를 결정합니다.
Local Preference 속성 적용 전 AS 외부로 가는 경로는 경로 우선순위 결정에 의해 각각 전달받은 eBGP 경로로 전달합니다. (R3 → R1 / R4 → R2)
R3#show ip bgp
...
Network Next Hop Metric LocPrf Weight Path
* I 110.1.0.0/24 4.4.4.4 0 100 0 100 i
*> 10.10.13.1 0 0 100 i
* I 110.1.1.0/24 4.4.4.4 0 100 0 100 i
*> 10.10.13.1 0 0 100 i
* I 110.1.2.0/24 4.4.4.4 0 100 0 100 i
*> 10.10.13.1 0 0 100 i
* I 120.2.0.0/24 4.4.4.4 0 100 0 100 i
*> 10.10.13.1 0 0 100 i
* I 120.2.1.0/24 4.4.4.4 0 100 0 100 i
*> 10.10.13.1 0 0 100 i
* I 120.2.2.0/24 4.4.4.4 0 100 0 100 i
*> 10.10.13.1 0 0 100 i
...
==============================================================================
R4#show ip bgp
...
Network Next Hop Metric LocPrf Weight Path
* I 110.1.0.0/24 3.3.3.3 0 100 0 100 i
*> 10.10.24.2 0 0 100 i
* I 110.1.1.0/24 3.3.3.3 0 100 0 100 i
*> 10.10.24.2 0 0 100 i
* I 110.1.2.0/24 3.3.3.3 0 100 0 100 i
*> 10.10.24.2 0 0 100 i
* I 120.2.0.0/24 3.3.3.3 0 100 0 100 i
*> 10.10.24.2 0 0 100 i
* I 120.2.1.0/24 3.3.3.3 0 100 0 100 i
*> 10.10.24.2 0 0 100 i
* I 120.2.2.0/24 3.3.3.3 0 100 0 100 i
*> 10.10.24.2 0 0 100 i
...
AS 외부로 나가는 경로를 R4를 통해서 나가도록 하기 위해 경로를 조정해 봅니다.
R4의 Local Preference 속성 값을 Default 100에서 200으로 높여 우선 순위를 갖도록 합니다.
R2에서 inbound 되는 경로에 대해 Local Preference 200을 적용 하였고 이 정보는 iBGP 내부로 전파됩니다.
R4#show run route-map
!
route-map rmap-LP permit 10
set local-preference 200
R4#show run bgp
!
router bgp 200
bgp router-id 4.4.4.4
network 140.4.0.0/24
network 140.4.1.0/24
network 140.4.2.0/24
timers bgp 2 6
neighbor 3.3.3.3 remote-as 200
neighbor 3.3.3.3 update-source Loopback 1
neighbor 3.3.3.3 timers 2 6
neighbor 3.3.3.3 next-hop-self
neighbor 3.3.3.3 soft-reconfiguration inbound
neighbor 3.3.3.3 no shutdown
neighbor 10.10.24.2 remote-as 100
neighbor 10.10.24.2 route-map rmap-LP in
neighbor 10.10.24.2 route-map rmap-MED out
neighbor 10.10.24.2 timers 2 6
neighbor 10.10.24.2 soft-reconfiguration inbound
neighbor 10.10.24.2 no shutdown
해당 정보를 전달 받은 iBGP Peer인 R3의 BGP 테이블을 확인해보면 R1, R2에 대한 경로가 기존 R1 → R4로 변경 되었습니다.
R4로 부터 받은 경로 정보가 Local Preference 200임에 따라 AS외부로 나가는 경로는 R4를 통해서 나가도록 되었습니다.
R3#show ip bgp
...
Network Next Hop Metric LocPrf Weight Path
*>I 110.1.0.0/24 4.4.4.4 0 200 0 100 i
* 10.10.13.1 0 0 100 i
*>I 110.1.1.0/24 4.4.4.4 0 200 0 100 i
* 10.10.13.1 0 0 100 i
*>I 110.1.2.0/24 4.4.4.4 0 200 0 100 i
* 10.10.13.1 0 0 100 i
*>I 120.2.0.0/24 4.4.4.4 0 200 0 100 i
* 10.10.13.1 0 0 100 i
*>I 120.2.1.0/24 4.4.4.4 0 200 0 100 i
* 10.10.13.1 0 0 100 i
*>I 120.2.2.0/24 4.4.4.4 0 200 0 100 i
* 10.10.13.1 0 0 100 i
...
==============================================================================
R3#show ip bgp 120.2.0.0
BGP routing table entry for 120.2.0.0/24
Paths: (2 available, table Default-IP-Routing-Table.)
Advertised to :
10.10.13.1
Received from :
4.4.4.4 (4.4.4.4) Best
AS_PATH : 100
Next-Hop : 4.4.4.4, Cost : 1
Origin IGP, Metric 0, LocalPref 200, Weight 0, internal
Received from :
10.10.13.1 (1.1.1.1)
AS_PATH : 100
Next-Hop : 10.10.13.1, Cost : 0
Origin IGP, Metric 0, LocalPref 100, Weight 0, external
Inactive reason: local pref
==============================================================================
R4#show ip bgp
...
Network Next Hop Metric LocPrf Weight Path
*> 110.1.0.0/24 10.10.24.2 0 200 0 100 i
*> 110.1.1.0/24 10.10.24.2 0 200 0 100 i
*> 110.1.2.0/24 10.10.24.2 0 200 0 100 i
*> 120.2.0.0/24 10.10.24.2 0 200 0 100 i
*> 120.2.1.0/24 10.10.24.2 0 200 0 100 i
*> 120.2.2.0/24 10.10.24.2 0 200 0 100 i
*>I 130.3.0.0/24 3.3.3.3 0 100 0 i
*>I 130.3.1.0/24 3.3.3.3 0 100 0 i
*>I 130.3.2.0/24 3.3.3.3 0 100 0 i
*>n 140.4.0.0/24 0.0.0.0 0 32768 i
*>n 140.4.1.0/24 0.0.0.0 0 32768 i
*>n 140.4.2.0/24 0.0.0.0 0 32768 i
R4#show ip bgp 120.2.0.0
BGP routing table entry for 120.2.0.0/24
Paths: (1 available, table Default-IP-Routing-Table.)
Advertised to :
3.3.3.3
Received from :
10.10.24.2 (2.2.2.2) Best
AS_PATH : 100
Next-Hop : 10.10.24.2, Cost : 0
Origin IGP, Metric 0, LocalPref 200, Weight 0, external
이번에는 R2에서 전달 받는 모든 경로에 대해 Local Preference 값을 적용하는 것이 아닌 R2 경로에 대해서만 Local Preference 200 값을 적용하려고 합니다.
다만, R2경로에 대해 route-map Local Preference 200 적용 후 나머지 대역에 대해서도 route-map permit을 적용해야 합니다.
해당 설정은 나머지 대역에 대해 속성 변경을 하지 않고 수용하도록 하기 위함으로 적용하지 않을 경우 나머지 대역에 대해서는 Deny 처리가 됩니다.
R4#show run prefix-list
!
ip prefix-list R2
seq 10 permit 120.2.0.0/24
seq 20 permit 120.2.1.0/24
seq 30 permit 120.2.2.0/24
seq 100 deny any
R4#show run route-map
!
route-map rmap-LP permit 10
match ip address R2
set local-preference 200
!
route-map rmap-LP permit 20 // 없을 경우 R2 외에 다른 대역 Deny
R4#clear ip bgp 10.10.24.2 soft in
==============================================================================
[route-map rmap-LP permit 20 미설정 시]
R4#show ip bgp neighbors 10.10.24.2 received-routes 110.1.0.0
BGP local RIB : Routes to be Added 0, Replaced 0, Withdrawn 0
BGP local router ID is 4.4.4.4
Status codes: s suppressed, S stale, d dampened, h history, * valid, > best
Path source: I - internal, a - aggregate, c - confed-external, r - redistributed
n - network, D - denied, S - stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
D 110.1.0.0/24 10.10.24.2 0 0 100 i
D 110.1.1.0/24 10.10.24.2 0 0 100 i
D 110.1.2.0/24 10.10.24.2 0 0 100 i
*> 120.2.0.0/24 10.10.24.2 0 0 100 i
*> 120.2.1.0/24 10.10.24.2 0 0 100 i
*> 120.2.2.0/24 10.10.24.2 0 0 100 i
==============================================================================
R4에서 R2 대역(120.2.0.0~2.0)에 대해서만 Local Preference 200으로 적용되었습니다.
R3에서 BGP 테이블 확인 시 Local Preference 값 변경으로 R2 대역은 R4로, 변경 되지 않은 R1 대역은 eBGP 경로인 R1으로 전달하게 됩니다.
R3#show ip bgp
...
Network Next Hop Metric LocPrf Weight Path
* I 110.1.0.0/24 4.4.4.4 0 100 0 100 i
*> 10.10.13.1 0 0 100 i
* I 110.1.1.0/24 4.4.4.4 0 100 0 100 i
*> 10.10.13.1 0 0 100 i
* I 110.1.2.0/24 4.4.4.4 0 100 0 100 i
*> 10.10.13.1 0 0 100 i
*>I 120.2.0.0/24 4.4.4.4 0 200 0 100 i
* 10.10.13.1 0 0 100 i
*>I 120.2.1.0/24 4.4.4.4 0 200 0 100 i
* 10.10.13.1 0 0 100 i
*>I 120.2.2.0/24 4.4.4.4 0 200 0 100 i
* 10.10.13.1 0 0 100 i
...
R3#show ip bgp 110.1.0.0
BGP routing table entry for 110.1.0.0/24
Paths: (2 available, table Default-IP-Routing-Table.)
Advertised to :
4.4.4.4
Received from :
4.4.4.4 (4.4.4.4)
AS_PATH : 100
Next-Hop : 4.4.4.4, Cost : 1
Origin IGP, Metric 0, LocalPref 100, Weight 0, internal
Inactive reason: from non external peer
Received from :
10.10.13.1 (1.1.1.1) Best
AS_PATH : 100
Next-Hop : 10.10.13.1, Cost : 0
Origin IGP, Metric 0, LocalPref 100, Weight 0, external
R3#show ip bgp 120.2.0.0
BGP routing table entry for 120.2.0.0/24
Paths: (2 available, table Default-IP-Routing-Table.)
Advertised to :
10.10.13.1
Received from :
4.4.4.4 (4.4.4.4) Best
AS_PATH : 100
Next-Hop : 4.4.4.4, Cost : 1
Origin IGP, Metric 0, LocalPref 200, Weight 0, internal
Received from :
10.10.13.1 (1.1.1.1)
AS_PATH : 100
Next-Hop : 10.10.13.1, Cost : 0
Origin IGP, Metric 0, LocalPref 100, Weight 0, external
Inactive reason: local pref
==============================================================================
R4#show ip bgp
...
* I 110.1.0.0/24 3.3.3.3 0 100 0 100 i
*> 10.10.24.2 0 0 100 i
* I 110.1.1.0/24 3.3.3.3 0 100 0 100 i
*> 10.10.24.2 0 0 100 i
* I 110.1.2.0/24 3.3.3.3 0 100 0 100 i
*> 10.10.24.2 0 0 100 i
*> 120.2.0.0/24 10.10.24.2 0 200 0 100 i
*> 120.2.1.0/24 10.10.24.2 0 200 0 100 i
*> 120.2.2.0/24 10.10.24.2 0 200 0 100 i
...
R4#show ip bgp 110.1.0.0
BGP routing table entry for 110.1.0.0/24
Paths: (1 available, table Default-IP-Routing-Table.)
Advertised to :
10.10.24.2
Received from :
3.3.3.3 (3.3.3.3) Best
AS_PATH : 100
Next-Hop : 3.3.3.3, Cost : 1
Origin IGP, Metric 0, LocalPref 100, Weight 0, internal
R4#show ip bgp 120.2.0.0
BGP routing table entry for 120.2.0.0/24
Paths: (1 available, table Default-IP-Routing-Table.)
Advertised to :
3.3.3.3
Received from :
10.10.24.2 (2.2.2.2) Best
AS_PATH : 100
Next-Hop : 10.10.24.2, Cost : 0
Origin IGP, Metric 0, LocalPref 200, Weight 0, external
'Network > BGP' 카테고리의 다른 글
[BGP] BGP 연동 실습#5 - Attribute를 이용한 경로 조정 (AS Prepend) (0) | 2025.02.10 |
---|---|
[BGP] BGP 연동 실습#4 - Attribute를 이용한 경로 조정 (MED) (0) | 2025.02.03 |
[BGP] BGP 연동 실습#2 - 특정 네트워크 광고 허용/거부 정책 적용 (Filtering) (0) | 2025.01.17 |
[BGP] Split Horizon 방지를 위한 Route-Reflector란? (0) | 2024.12.28 |
[BGP] BGP 연동 실습#1 - 네이버 연결 및 라우팅 확인 (0) | 2024.12.19 |