본 제품에 대한 문서 세트는 편견 없는 언어를 사용하기 위해 노력합니다. 본 설명서 세트의 목적상, 편견 없는 언어는 나이, 장애, 성별, 인종 정체성, 민족 정체성, 성적 지향성, 사회 경제적 지위 및 교차성에 기초한 차별을 의미하지 않는 언어로 정의됩니다. 제품 소프트웨어의 사용자 인터페이스에서 하드코딩된 언어, RFP 설명서에 기초한 언어 또는 참조된 서드파티 제품에서 사용하는 언어로 인해 설명서에 예외가 있을 수 있습니다. 시스코에서 어떤 방식으로 포용적인 언어를 사용하고 있는지 자세히 알아보세요.
Cisco는 전 세계 사용자에게 다양한 언어로 지원 콘텐츠를 제공하기 위해 기계 번역 기술과 수작업 번역을 병행하여 이 문서를 번역했습니다. 아무리 품질이 높은 기계 번역이라도 전문 번역가의 번역 결과물만큼 정확하지는 않습니다. Cisco Systems, Inc.는 이 같은 번역에 대해 어떠한 책임도 지지 않으며 항상 원본 영문 문서(링크 제공됨)를 참조할 것을 권장합니다.
이 문서에서는 BGP 커뮤니티 값을 사용하여 업스트림 공급자 네트워크에서 라우팅 정책을 제어하는 방법에 대해 설명합니다.
이 문서에서는 BGP 라우팅 프로토콜 및 해당 작업을 이해해야 합니다.
이 문서는 특정 소프트웨어 및 하드웨어 버전으로 한정되지 않습니다. 그러나 이 문서의 정보는 다음 소프트웨어 및 하드웨어 버전을 기반으로 합니다.
Cisco IOS® 소프트웨어 릴리스 12.2(27)
Cisco 2500 Series 라우터
이 문서의 정보는 특정 랩 환경의 디바이스를 토대로 작성되었습니다. 이 문서에 사용된 모든 디바이스는 초기화된(기본) 컨피그레이션으로 시작되었습니다. 현재 네트워크가 작동 중인 경우 모든 명령의 잠재적인 영향을 미리 숙지하시기 바랍니다.
커뮤니티 자체는 BGP Best Path 프로세스를 변경하지 않지만, 커뮤니티를 플래그로 사용하여 경로 집합을 표시할 수 있습니다. 그런 다음 업스트림 통신 사업자 라우터는 이러한 플래그를 사용하여 네트워크 내에서 특정 라우팅 정책(예: 로컬 환경 설정)을 적용할 수 있습니다.
제공 기관은 구성 가능한 커뮤니티 값과 제공 기관 네트워크 내의 해당 로컬 환경 설정 값 간에 매핑됩니다. 제공자 네트워크에서 LOCAL_PREF를 수정해야 하는 특정 정책이 라우팅 업데이트의 해당 커뮤니티 값을 설정할 수 있습니다.
커뮤니티는 일부 공통 속성을 공유하며 BGP 커뮤니티 특성으로 구성할 수 있는 접두사 그룹입니다. BGP 커뮤니티 특성은 변수 길이의 선택적 전이적 특성입니다. 특성은 커뮤니티를 지정하는 4개의 8진수 값 집합으로 구성됩니다. 커뮤니티 특성 값은 처음 두 8진에서 AS(Autonomous System) 번호로 인코딩되며, 나머지 두 8진수는 AS로 정의됩니다. 접두사는 둘 이상의 커뮤니티 특성을 가질 수 있습니다. 접두사에서 여러 커뮤니티 특성을 보는 BGP 스피커는 하나, 일부 또는 전체 특성을 기반으로 작동할 수 있습니다. 라우터는 라우터가 다른 피어에 특성을 전달하기 전에 커뮤니티 특성을 추가하거나 수정할 수 있습니다. 커뮤니티 특성에 대한 자세한 내용은 BGP 사례 연구를 참조하십시오.
로컬 환경 설정 특성은 AS에서 특정 네트워크에 연결하려는 경로를 나타냅니다. 동일한 대상에 대한 여러 경로가 있는 경우 기본 설정이 더 높은 경로가 선택됩니다(로컬 기본 설정 속성의 기본값은 100). 자세한 내용은 사례 연구를 참조하십시오.
문서 규칙에 대한 자세한 내용은 Cisco 기술 팁 표기 규칙을 참조하십시오.
참고: 이 문서에 사용된 명령에 대한 추가 정보를 찾으려면 명령 조회 도구를 사용합니다.
간소화를 위해 업스트림 서비스 공급자(AS 100)와 디바이스(AS 30) 간에 커뮤니티 특성 및 로컬 환경 설정 특성 매핑이 설정된 것으로 가정합니다.
로컬 기본 설정 |
커뮤니티 값 |
130 |
100:300 |
125 |
100:250 |
접두사가 100:300과 같은 커뮤니티 특성으로 선언되면 업스트림 서비스 공급자는 해당 경로의 로컬 환경 설정을 130과 125로 설정합니다(커뮤니티 특성이 100:250이면).
이렇게 하면 통신 사업자에게 발표된 접두사의 커뮤니티 값을 변경할 경우 통신 사업자 네트워크 내에서 라우팅 정책을 제어할 수 있습니다.
네트워크 다이어그램에서 AS 30은 이 라우팅 정책을 커뮤니티 특성과 함께 사용하려고 합니다.
네트워크 10.0.10.0/24으로 향하는 AS 100의 인바운드 트래픽은 R1-R3 링크를 통해 이동합니다. R1-R3 링크에 장애가 발생하면 모든 트래픽이 R2-R3을 통해 이동합니다.
네트워크 10.1.0.0/24으로 향하는 AS 100의 인바운드 트래픽은 R2-R3 링크를 통해 이동합니다. R2-R3 링크에 장애가 발생하면 모든 트래픽이 R1-R3을 통해 이동합니다.
이 라우팅 정책을 달성하기 위해 R3는 다음과 같이 접두사를 발표합니다.
R1까지:
R2로
커뮤니티 특성이 100:250인 10.0.10.0/24
커뮤니티 특성이 100:300인 10.1.0.0/24
BGP 인접 디바이스 R1 및 R2가 R3에서 접두사를 수신하면 R1 및 R2는 커뮤니티 및 로컬 기본 설정 특성 간의 매핑에 따라 구성된 정책을 적용하므로(이전 표에 표시됨) 사용자가 지정한 라우팅 정책을 달성할 수 있습니다. R1은 BGP 테이블에 접두사를 설치합니다.
10.0.10.0/24으로컬 환경 설정 130
10.1.0.0/24으로컬 환경 설정 125
R2는 BGP 테이블에 접두사를 설치합니다.
10.0.10.0/24으로컬 환경 설정 125
10.1.0.0/24으로컬 환경 설정 130
BGP 경로 선택 기준에서는 더 높은 로컬 환경 설정이 우선하므로 로컬 환경 설정이 130(130이 125보다 큼)인 경로가 AS 100 내에서 최상의 경로로 선택되고 R1 및 R2의 IP 라우팅 테이블에 설치됩니다. BGP 경로 선택 기준에 대한 자세한 내용은 BGP 최적 경로 선택 알고리즘을 참조하십시오.
BGP 네트워킹
이 문서에서는 다음 설정을 사용합니다.
R3
R1
R2
Current configuration : 2037 bytes
!
version 12.2
!
hostname R3
!
interface Loopback0
ip address 10.0.10.0 255.255.255.0
!
interface Ethernet0/0
ip address 10.1.0.0 255.255.255.1
!
interface Serial8/0
ip address 10.10.13.3 255.255.255.0
!--- Interface connected to R1.
!
interface Serial9/0
ip address 10.10.23.3 255.255.255.0
!--- Interface connected to R2.
!
router bgp 30
network 10.0.10.0 mask 255.255.255.0
network 10.1.0.0 mask 255.255.255.1
!--- Network commands announce prefix 10.0.10.0/24
!--- and 10.1.0.0/24.
neighbor 10.10.13.1 remote-as 100
!--- Establishes peering with R1.
neighbor 10.10.13.1 send-community
- !--- Without this command, the community attributes !--- are not sent to the neighbor.
neighbor 10.10.13.1 route-map Peer-R1 out
!--- Configures outbound policy as defined by
!--- route-map "Peer-R1" when peering with R1.
neighbor 10.10.23.2 remote-as 100
!--- Establishes peering with R2.
neighbor 10.10.23.2 send-community
!--- Configures to send community attribute to R2.
neighbor 10.10.23.2 route-map Peer-R2 out
!--- Configures outbound policy as defined by
!--- route-map "Peer-R2" when peering with R2.
no auto-summary
!
ip classless
ip bgp-community new-format
!--- Allows you to configure the BGP community
!--- attribute in AA:NN format.
!
access-list 101 permit ip host 10.0.10.0 host 255.255.255.0
access-list 102 permit ip host 10.1.0.0 host 255.255.255.1
!
!
route-map Peer-R1 permit 10
match ip address 101
set community 100:300
!--- Sets community 100:300 for routes matching access-list 101.
!
route-map Peer-R1 permit 20
match ip address 102
set community 100:250
!--- Sets community 100:250 for routes matching access-list 102.
!
route-map Peer-R2 permit 10
match ip address 101
set community 100:250
!--- Sets community 100:250 for routes matching access-list 101.
!
route-map Peer-R2 permit 20
match ip address 102
set community 100:300
!--- Sets community 100:300 for routes matching access-list 102.
!
end
Version 12.2
!
hostname R1
!
interface Loopback0
ip address 200.200.10.1 255.255.255.0
!
interface Serial8/0
ip address 10.10.13.1 255.255.255.1
!--- Connected to R3.
!
interface Serial10/0
ip address 10.10.12.1 255.255.255.0
!--- Connected to R2.
!
router bgp 100
no synchronization
bgp log-neighbor-changes
neighbor 10.10.12.2 remote-as 100
!--- Establishes peering with R2.
neighbor 10.10.12.2 next-hop-self
neighbor 10.10.13.3 remote-as 30
!--- Establishes peering with R3.
neighbor 10.10.13.3 route-map Peer-R3 in
!--- Configures the inbound policy as defined by
!--- route-map "Peer-R3" when peering with R3.
no auto-summary
!
ip bgp-community new-format
!--- Allows you to configure the BGP community
!--- attribute in AA:NN format.
ip community-list 1 permit 100:300
ip community-list 2 permit 100:250
!--- Defines community list 1 and 2.
!
route-map Peer-R3 permit 10
match community 1
set local-preference 130
!--- Sets local preference 130 for all routes
!--- matching community list 1.
!
route-map Peer-R3 permit 20
match community 2
set local-preference 125
!--- Sets local preference 125 for all routes
!--- matching community list 2.
!
route-map Peer-R3 permit 30
!--- Without this permit 30 statement, updates that do not
!--- match the permit 10 or permit 20 statements are dropped.
!
end
Version 12.2
!
hostname R2
!
interface Loopback0
ip address 10.0.10.0 255.255.255.0
!
interface Serial9/0
ip address 10.10.23.2 255.255.255.1
!--- Connected to R3.
!
interface Serial10/0
ip address 10.10.12.2 255.255.255.0
!--- Connected to R1.
!
router bgp 100
no synchronization
bgp log-neighbor-changes
neighbor 10.10.12.1 remote-as 100
!--- Establishes iBGP peering with R1.
neighbor 10.10.12.1 next-hop-self
neighbor 10.10.23.3 remote-as 30
!--- Establishes peering with R3.
neighbor 10.10.23.3 route-map Peer-R3 in
!--- Configures inbound policy as defined by
!--- route-map "Peer-R3" when peering with R3.
no auto-summary
!
ip bgp-community new-format
!--- Allows you to configure the BGP community
!--- attribute in AA:NN format.
!
ip community-list 1 permit 100:300
ip community-list 2 permit 100:250
!--- Defines community list 1 and 2.
!
route-map Peer-R3 permit 10
match community 1
set local-preference 130
!--- Sets local preference 130 for all routes
!--- matching community list 1.
!
route-map Peer-R3 permit 20
match community 2
set local-preference 125
!--- Sets local preference 125 for all routes
!--- matching community list 2.
!
route-map Peer-R3 permit 30
!--- Without this permit 30 statement, updates that do not
!--- match the permit 10 or permit 20 statements are dropped.
!
end
R1은 다음 show ip bgp 명령 출력 결과에 표시된 대로 커뮤니티 100:300 및 100:250에서 접두사 10.0.10.0/24 및 10.1.0.0/24을 받습니다.
참고: 구성된 정책에 따라 이러한 경로를 BGP 테이블에 설치하면 커뮤니티 100:300의 접두사에 로컬 환경 설정 130이 할당되고 커뮤니티 100:250의 접두사에 로컬 환경 설정 125가 할당됩니다.
R1# show ip bgp 10.0.10.0
BGP routing table entry for 10.0.10.0/24, version 2
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Advertised to non peer-group peers:
10.10.12.2
30
10.10.13.3 from 10.10.13.3 (10.0.10.0)
Origin IGP, metric 0, localpref 130, valid, external, best
Community: 100:300
!--- Prefix 10.0.10.0/24 with community 100:300 received from
!--- 10.10.13.3 (R3) is assigned local preference 130.
R1# show ip bgp 10.1.0.0
BGP routing table entry for 10.1.0.0/24, version 4
Paths: (2 available, best #1, table Default-IP-Routing-Table)
Advertised to non peer-group peers:
10.10.13.3
30
10.10.12.2 from 10.10.12.2 (10.1.0.0)
Origin IGP, metric 0, localpref 130, valid, internal, best
.0!--- Received prefix 10.1.0.0/24 over iBGP from 10.10.12.2
!--- (R2) with local preference 130.
!--- (R2) with local preference 130.
30
10.10.13.3 from 10.10.13.3 (198.50.100.0)
Origin IGP, metric 0, localpref 125, valid, external
Community: 100:250
!--- Prefix 10.1.0.0/24 with community 100:250 received from
!--- 10.10.13.3 (R3) is assigned local preference 125.
R1# show ip bgp
BGP table version is 4, local router ID is 200.200.10.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
*> 10.0.10.0/24 10.10.13.3 0 130 0 30 i
*>i 10.1.0.0/24 10.10.12.2 0 130 0 30 i
* 10.10.13.3 0 125 0 30 i
R1의 show ip bgp 명령은 R1에서 선택한 최상의 경로가 로컬 환경 설정(LocalPrf) = 130인 것을 확인합니다. 마찬가지로 R2는 커뮤니티 100:250 및 100:300의 접두사 10.0.10.0/24 및 10.1.0.0/24을 수신합니다(이 show bgp 명령 출력에 굵은 글꼴로 표시됨).
참고: 구성된 정책에 따라 이러한 경로를 BGP 테이블에 설치하면 커뮤니티 100:300의 접두사에 로컬 환경 설정 130이 할당되고 커뮤니티 100:250의 접두사에 로컬 환경 설정 125가 할당됩니다.
R2# show ip bgp 10.0.10.0
BGP routing table entry for 10.0.10.0/24, version 2
Paths: (2 available, best #2, table Default-IP-Routing-Table)
Advertised to non peer-group peers:
10.10.23.3
30
10.10.23.3 from 10.10.23.3 (10.0.10.0)
Origin IGP, metric 0, localpref 125, valid, external
Community: 100:250
!--- Prefix 10.0.10.0/24 with community 100:250 received from
!--- 10.10.23.3 (R3) is assigned local preference 125.
30
10.10.12.1 from 10.10.12.1 (200.200.10.1)
Origin IGP, metric 0, localpref 130, valid, internal, best
!--- Received prefix 10.0.10.0/24 over iBGP from 10.10.12.1
!--- (R1) with local preference 130.
R2# show ip bgp 10.0.10.0
BGP routing table entry for 10.0.10.0/24, version 3
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Advertised to non peer-group peers:
10.10.12.1
30
10.10.23.3 from 10.10.23.3 (10.0.10.0)
Origin IGP, metric 0, localpref 130, valid, external, best
Community: 100:300
!--- Prefix 10.1.0.0/24 with community 100:300 received from
!--- 10.10.23.3 (R3) is assigned local preference 130.
R2# show ip bgp
BGP table version is 3, local router ID is 192.168.50.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
* 10.0.10.0/24 10.10.23.3 0 125 0 30 i
*>i 10.10.12.1 0 130 0 30 i
*> 10.1.0.0/24 10.10.23.3 0 130 0 30 i
이 show ip bgp 명령 출력은 R2에서 선택한 최상의 경로가 로컬 기본 설정(loclPrf) = 130임을 확인합니다. 접두사 10.0.10.0/24에 대한 IP 경로는 AS 100에서 AS 30으로 나가는 R1-R3 링크를 선호합니다. R1 및 R2의 show ip route 명령은 이 기본 설정을 확인합니다.
R1# show ip route 10.0.10.0
Routing entry for 10.0.10.0/24
Known via "bgp 100", distance 20, metric 0
Tag 30, type external
Last update from 10.10.13.3 3d21h ago
Routing Descriptor Blocks:
* 10.10.13.3, from 10.10.13.3, 3d21h ago
Route metric is 0, traffic share count is 1
AS Hops 1
!--- On R1, the IP route to prefix 10.0.10.0/24 points
!--- to next hop 10.10.13.3 which is R3 serial 8/0
!--- interface on the R1-R3 link.
R2# show ip route 10.1.0.0
Routing entry for 10.1.0.0/24
Known via "bgp 100", distance 200, metric 0
Tag 30, type internal
Last update from 10.10.12.1 3d21h ago
Routing Descriptor Blocks:
* 10.10.12.1, from 10.10.12.1, 3d21h ago
Route metric is 0, traffic share count is 1
AS Hops 1
!--- On R2, IP route to prefix 10.1.0.0/24 points
!--- to next hop R1 (10.10.12.1) on its iBGP link.
!--- Thus traffic to network 10.1.0.0/24 from R2
!--- exits through R2-R1 and then R1-R3 link from
!--- AS 100 towards AS 30.
접두사 10.1.0.0/24에 대한 IP 경로는 R2-R3 링크를 선호하여 AS 30에 대한 AS 100에서 종료되도록 합니다. R1 및 R2의 show ip route 명령을 사용하면 이 기본 설정을 확인할 수 있습니다.
R2# show ip route 10.1.0.0
Routing entry for 10.1.0.0/24
Known via "bgp 100", distance 20, metric 0
Tag 30, type external
Last update from 10.10.23.3 3d22h ago
Routing Descriptor Blocks:
* 10.10.23.3, from 10.10.23.3, 3d22h ago
Route metric is 0, traffic share count is 1
AS Hops 1
!--- On R2, IP route to prefix 10.1.0.0/24 points
!--- to next hop 10.10.23.3 which is R3 serial 9/0
!--- interface on R2-R3 link.
R1# show ip route 10.1.0.0
Routing entry for 10.1.0.0/24
Known via "bgp 100", distance 200, metric 0
Tag 30, type internal
Last update from 10.10.12.2 3d22h ago
Routing Descriptor Blocks:
* 10.10.12.2, from 10.10.12.2, 3d22h ago
Route metric is 0, traffic share count is 1
AS Hops 1
!--- On R1, IP route to prefix 10.1.0.0/24 points
!--- to next hop R2 (10.10.12.2) on its iBGP link.
!--- Thus traffic to network 10.1.0.0/24 from R1
!--- exits through R1-R2 and then R2-R3 link
!--- from AS 100 towards AS 30.
링크 하나가 실패하면(예: R1-R3 링크) 모든 트래픽이 R2-R3 링크를 따라야 합니다. R1-R3 간의 링크를 종료하면 이 트래픽을 시뮬레이션할 수 있습니다.
R1# conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int s8/0
R1(config-if)#shut
R1(config-if)#
3d22h: %BGP-5-ADJCHANGE: neighbor 10.10.13.3 Down Interface flap
3d22h: %LINK-5-CHANGED: Interface Serial8/0, changed state to
administratively down
3d22h: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial8/0,
changed state to down
R1 및 R2의 접두사 10.0.10.0/24 및 10.1.0.0/24에 대한 IP 라우팅 테이블을 확인합니다. AS 100을 종료하려면 R2-R3 링크를 사용합니다.
R1# show ip route 10.0.10.0
Routing entry for 10.0.10.0/24
Known via "bgp 100", distance 200, metric 0
Tag 30, type internal
Last update from 10.10.12.2 00:01:47 ago
Routing Descriptor Blocks:
* 10.10.12.2, from 10.10.12.2, 00:01:47 ago
Route metric is 0, traffic share count is 1
AS Hops 1
R1# show ip route 10.1.0.0
Routing entry for 10.1.0.0/24
Known via "bgp 100", distance 200, metric 0
Tag 30, type internal
Last update from 10.10.12.2 3d22h ago
Routing Descriptor Blocks:
* 10.10.12.2, from 10.10.12.2, 3d22h ago
Route metric is 0, traffic share count is 1
AS Hops 1
이 show 명령 출력은 prefixes10.0.10.0/24 및 10.1.0.0/24에 대한 경로가 예상된 next hop 10.10.12.2, (R2)을 가리키는 것을 보여줍니다. 이제 R2의 IP 라우팅 테이블을 확인하여 접두사 10.0.10.0/24 및 10.1.0.0/24의 next-hop을 확인합니다. 다음 홉은 구성된 정책이 성공적으로 작동하려면 R3이어야 합니다.
R2# show ip route 10.0.10.0
Routing entry for 10.0.10.0/24
Known via "bgp 100", distance 20, metric 0
Tag 30, type external
Last update from 10.10.23.3 00:04:10 ago
Routing Descriptor Blocks:
* 10.10.23.3, from 10.10.23.3, 00:04:10 ago
Route metric is 0, traffic share count is 1
AS Hops 1
R2# show ip route 10.1.0.0
Routing entry for 10.1.0.0/24
Known via "bgp 100", distance 20, metric 0
Tag 30, type external
Last update from 10.10.23.3 3d22h ago
Routing Descriptor Blocks:
* 10.10.23.3, from 10.10.23.3, 3d22h ago
Route metric is 0, traffic share count is 1
AS Hops 1
다음 홉은 R2-R3 링크의 R3 Serial 9/0 인터페이스입니다. 이렇게 하면 구성된 정책이 예상대로 작동하는지 확인합니다.
개정 | 게시 날짜 | 의견 |
---|---|---|
4.0 |
11-Jul-2022 |
Cisco.com에 대한 재인증 7/5/2022 및 7/6/2022 및 재게시 개선 다시 수정하고 7/11/2022에서 다시 게시합니다. |
3.0 |
06-Jul-2022 |
Cisco.com에 대한 재인증 7/5/2022 및 7/6/2022 및 재게시 개선 |
2.0 |
22-Jun-2022 |
Cisco.com에 대한 재인증 |
1.0 |
12-Nov-2002 |
최초 릴리스 |