예를 들면 다음과 같습니다. 정책 체인 및 경로 필터 구성
정책 체인은 구성의 특정 섹션 내에서 여러 정책을 적용하는 것입니다. 경로 필터는 일치 접두사의 집합입니다.
요구 사항
이 예를 구성하기 전에 디바이스 초기화를 제외한 특별한 구성은 필요하지 않습니다.
개요
BGP에 적용되는 정책 체인의 예는 다음과 같습니다.
user@R1# show protocols bgp group int { type internal; local-address 192.168.0.1; export [ adv-statics adv-large-aggregates adv-small-aggregates ]; neighbor 192.168.0.2; neighbor 192.168.0.3; }
adv-statics
, adv-large-aggregates
및 adv-small-aggregates
정책은 기본 BGP 정책 외에도 디바이스 R1의 BGP 피어에 적용된 정책 체인을 구성합니다. 정책 중 두 가지는 서로 다른 일치 유형을 가진 경로 필터를 보여줍니다. 다른 정책은 모든 정적 경로와 일치하므로 경로 필터가 필요하지 않습니다.
user@R1# show policy-options policy-statement adv-large-aggregates { term between-16-and-18 { from { protocol aggregate; route-filter 172.16.0.0/16 upto /18; } then accept; } } policy-statement adv-small-aggregates { term between-19-and-24 { from { protocol aggregate; route-filter 172.16.0.0/16 prefix-length-range /19-/24; } then accept; } } policy-statement adv-statics { term statics { from protocol static; then accept; } }
선택적으로 이 정책 체인을 내부 BGP(IBGP) 피어에 대한 단일 다중 정책으로 변환할 수 있습니다. 이렇게 하면 정책 체인의 장점 중 하나는 다른 목적으로 정책을 재사용할 수 있는 기능이 손실됩니다.
그림 1 은(는) AS 64510의 디바이스 R1을 IBGP 피어, 디바이스 R2 및 디바이스 R3과 함께 표시합니다. 디바이스 R1은 또한 AS 64511의 디바이스 R4와 AS 64512의 디바이스 R5에 대한 외부 BGP(EBGP) 연결을 가지고 있습니다. 현재 AS 64510 내의 관리 정책은 고객 정적 경로만 다른 IBGP 피어로 전송하는 것입니다. 전송 서비스를 제공하는 모든 EBGP 피어는 마스크 길이가 18비트보다 작은 집계 경로만 수신합니다. 피어링 서비스를 제공하는 모든 EBGP 피어는 모든 고객 경로와 마스크 길이가 19비트보다 큰 모든 어그리게이션을 수신합니다. 이러한 관리 정책의 각 부분은 구성 계층 내 [edit policy-opitons]
의 별도의 라우팅 정책 구성됩니다. 이러한 정책은 AS 64510 관리자에게 피어에 경로를 보급하기 위한 여러 구성 옵션을 제공합니다.
디바이스 R4는 AS 64510에 전송 서비스를 제공하고 있으며, 이를 통해 AS는 할당된 라우팅 공간을 인터넷에 보급할 수 있습니다. 한편, 디바이스 R5에서 제공하는 피어링 서비스를 통해 AS 64510은 모든 고객 경로에 대해 AS(Autonomous System)간에 직접 트래픽을 라우팅할 수 있습니다.
토폴로지
그림 1 은 샘플 네트워크를 보여줍니다.

CLI 빠른 구성 은(는) 의 모든 디바이스 그림 1에 대한 구성을 보여줍니다.
섹션 #configuration283__policy-chains-st 은 디바이스 R1의 단계를 설명합니다.
구성
CLI 빠른 구성
이 예를 빠르게 구성하려면, 아래 명령을 복사하여 텍스트 파일로 붙여 넣은 다음 모든 라인브러브를 제거하고, 네트워크 구성을 일치하는 데 필요한 세부 사항을 변경한 다음 계층 수준에서 명령을 CLI [edit]
로 복사해 붙여 넣습니다.
디바이스 R1
set interfaces fe-1/2/0 unit 0 description to_R2 set interfaces fe-1/2/0 unit 0 family inet address 10.0.0.1/30 set interfaces fe-1/2/2 unit 0 description to_R3 set interfaces fe-1/2/2 unit 0 family inet address 10.0.0.5/30 set interfaces fe-1/2/3 unit 0 description to_R4 set interfaces fe-1/2/3 unit 0 family inet address 10.1.0.5/30 set interfaces fe-1/2/1 unit 0 description to_R5 set interfaces fe-1/2/1 unit 0 family inet address 10.0.0.10/30 set interfaces lo0 unit 0 family inet address 192.168.0.1/32 set protocols bgp group int type internal set protocols bgp group int local-address 192.168.0.1 set protocols bgp group int export adv-statics set protocols bgp group int export adv-large-aggregates set protocols bgp group int export adv-small-aggregates set protocols bgp group int neighbor 192.168.0.2 set protocols bgp group int neighbor 192.168.0.3 set protocols bgp group to_64511 type external set protocols bgp group to_64511 export adv-large-aggregates set protocols bgp group to_64511 neighbor 10.1.0.6 peer-as 64511 set protocols bgp group to_64512 type external set protocols bgp group to_64512 export adv-small-aggregates set protocols bgp group to_64512 export adv-statics set protocols bgp group to_64512 neighbor 10.0.0.9 peer-as 64512 set protocols ospf area 0.0.0.0 interface fe-1/2/0.0 set protocols ospf area 0.0.0.0 interface fe-1/2/2.0 set protocols ospf area 0.0.0.0 interface lo0.0 passive set policy-options policy-statement adv-large-aggregates term between-16-and-18 from protocol aggregate set policy-options policy-statement adv-large-aggregates term between-16-and-18 from route-filter 172.16.0.0/16 upto /18 set policy-options policy-statement adv-large-aggregates term between-16-and-18 then accept set policy-options policy-statement adv-small-aggregates term between-19-and-24 from protocol aggregate set policy-options policy-statement adv-small-aggregates term between-19-and-24 from route-filter 172.16.0.0/16 prefix-length-range /19-/24 set policy-options policy-statement adv-small-aggregates term between-19-and-24 then accept set policy-options policy-statement adv-statics term statics from protocol static set policy-options policy-statement adv-statics term statics then accept set routing-options static route 172.16.1.16/28 discard set routing-options static route 172.16.1.32/28 discard set routing-options static route 172.16.1.48/28 discard set routing-options static route 172.16.1.64/28 discard set routing-options aggregate route 172.16.0.0/16 set routing-options aggregate route 172.16.1.0/24 set routing-options router-id 192.168.0.1 set routing-options autonomous-system 64510
디바이스 R2
set interfaces fe-1/2/0 unit 0 description to_R1 set interfaces fe-1/2/0 unit 0 family inet address 10.0.0.2/30 set interfaces fe-1/2/1 unit 0 description to_R3 set interfaces fe-1/2/1 unit 0 family inet address 10.1.0.1/30 set interfaces lo0 unit 0 family inet address 192.168.0.2/32 set protocols bgp group int type internal set protocols bgp group int local-address 192.168.0.2 set protocols bgp group int neighbor 192.168.0.1 export send-static-aggregate set protocols bgp group int neighbor 192.168.0.3 set protocols ospf area 0.0.0.0 interface fe-1/2/0.0 set protocols ospf area 0.0.0.0 interface fe-1/2/1.0 set protocols ospf area 0.0.0.0 interface lo0.0 passive set policy-options policy-statement send-static-aggregate term 1 from protocol static set policy-options policy-statement send-static-aggregate term 1 from protocol aggregate set policy-options policy-statement send-static-aggregate term 1 then accept set routing-options static route 172.16.2.16/28 discard set routing-options static route 172.16.2.32/28 discard set routing-options static route 172.16.2.48/28 discard set routing-options static route 172.16.2.64/28 discard set routing-options aggregate route 172.16.2.0/24 set routing-options aggregate route 172.16.0.0/16 set routing-options router-id 192.168.0.2 set routing-options autonomous-system 64510
디바이스 R3
set interfaces fe-1/2/1 unit 0 description to_R2 set interfaces fe-1/2/1 unit 0 family inet address 10.1.0.2/30 set interfaces fe-1/2/2 unit 0 description to_R1 set interfaces fe-1/2/2 unit 0 family inet address 10.0.0.6/30 set interfaces lo0 unit 0 family inet address 192.168.0.3/32 set protocols bgp group int type internal set protocols bgp group int local-address 192.168.0.3 set protocols bgp group int neighbor 192.168.0.1 export send-static-aggregate set protocols bgp group int neighbor 192.168.0.2 set protocols ospf area 0.0.0.0 interface fe-1/2/2.0 set protocols ospf area 0.0.0.0 interface fe-1/2/1.0 set protocols ospf area 0.0.0.0 interface lo0.0 passive set policy-options policy-statement send-static-aggregate from protocol static set policy-options policy-statement send-static-aggregate from protocol aggregate set policy-options policy-statement send-static-aggregate then accept set routing-options static route 172.16.3.16/28 discard set routing-options static route 172.16.3.32/28 discard set routing-options static route 172.16.3.48/28 discard set routing-options static route 172.16.3.64/28 discard set routing-options aggregate route 172.16.0.0/16 set routing-options aggregate route 172.16.3.0/24 set routing-options router-id 192.168.0.3 set routing-options autonomous-system 64510
디바이스 R4
set interfaces fe-1/2/3 unit 0 description to_R1 set interfaces fe-1/2/3 unit 0 family inet address 10.1.0.6/30 set interfaces lo0 unit 0 family inet address 192.168.0.4/32 set protocols bgp group ext type external set protocols bgp group ext peer-as 64510 set protocols bgp group ext neighbor 10.1.0.5 set routing-options autonomous-system 64511
디바이스 R5
set interfaces fe-1/2/1 unit 0 description to_R1 set interfaces fe-1/2/1 unit 0 family inet address 10.0.0.9/30 set interfaces lo0 unit 0 family inet address 192.168.0.5/32 set protocols bgp group ext type external set protocols bgp group ext neighbor 10.0.0.10 peer-as 64510 set routing-options autonomous-system 64512
절차
단계별 절차
다음 예는 구성 계층에서 다양한 수준의 탐색이 필요합니다. CLI 탐색에 대한 정보는 Junos OS CLI 사용자 가이드에서 을(를) 참조하십시오구성 모드에서 CLI 편집기 사용.
디바이스 R1 구성:
디바이스 인터페이스를 구성합니다.
[edit interfaces] user@R1# set fe-1/2/0 unit 0 description to_R2 user@R1# set fe-1/2/0 unit 0 family inet address 10.0.0.1/30 user@R1# set fe-1/2/2 unit 0 description to_R3 user@R1# set fe-1/2/2 unit 0 family inet address 10.0.0.5/30 user@R1# set fe-1/2/3 unit 0 description to_R4 user@R1# set fe-1/2/3 unit 0 family inet address 10.1.0.5/30 user@R1# set fe-1/2/1 unit 0 description to_R5 user@R1# set fe-1/2/1 unit 0 family inet address 10.0.0.10/30 user@R1# set lo0 unit 0 family inet address 192.168.0.1/32
디바이스 R2 및 디바이스 R3에 대한 IBGP 연결을 구성합니다.
[edit protocols bgp group int] user@R1# set type internal user@R1# set local-address 192.168.0.1 user@R1# set neighbor 192.168.0.2 user@R1# set neighbor 192.168.0.3
내부 피어에 대한 내보내기 정책을 적용합니다.
[edit protocols bgp group int] user@R1# set export adv-statics user@R1# set export adv-large-aggregates user@R1# set export adv-small-aggregates
디바이스 R4에 대한 EBGP 연결을 구성합니다.
[edit protocols bgp group to_64511] user@R1# set type external user@R1# set neighbor 10.1.0.6 peer-as 64511
디바이스 R4에 대한 내보내기 정책을 적용합니다.
[edit protocols bgp group to_64511] user@R1# set export adv-large-aggregates
디바이스 R5에 대한 EBGP 연결을 구성합니다.
[edit protocols bgp group to_64512] user@R1# set type external user@R1# set neighbor 10.0.0.9 peer-as 64512
디바이스 R5에 대한 내보내기 정책을 적용합니다.
[edit protocols bgp group to_64512] user@R1# set export adv-small-aggregates user@R1# set export adv-statics
디바이스 R2 및 디바이스 R3에 대한 OSPF 연결을 구성합니다.
[edit protocols ospf area 0.0.0.0] user@R1# set interface fe-1/2/0.0 user@R1# set interface fe-1/2/2.0 user@R1# set interface lo0.0 passive
라우팅 정책을 구성합니다.
[edit policy-options policy-statement adv-large-aggregates term between-16-and-18] user@R1# set from protocol aggregate user@R1# set from route-filter 172.16.0.0/16 upto /18 user@R1# set then accept [edit policy-options policy-statement adv-small-aggregates term between-19-and-24] user@R1# set from protocol aggregate user@R1# set from route-filter 172.16.0.0/16 prefix-length-range /19-/24 user@R1# set then accept [edit policy-options policy-statement adv-statics term statics] user@R1# set from protocol static user@R1# set then accept
정적 및 어그리게이션 경로를 구성합니다.
[edit routing-options static] user@R1# set route 172.16.1.16/28 discard user@R1# set route 172.16.1.32/28 discard user@R1# set route 172.16.1.48/28 discard user@R1# set route 172.16.1.64/28 discard [edit routing-options aggregate] user@R1# set route 172.16.0.0/16 user@R1# set route 172.16.1.0/24
AS(Autonomous System) 번호와 라우터 ID를 구성합니다.
[edit routing-options] user@R1# set router-id 192.168.0.1 user@R1# set autonomous-system 64510
결과
구성 모드에서 , , show protocols
show policy-options
및 show routing-options
명령을 입력show interfaces
하여 구성을 확인합니다. 출력에 의도한 구성이 표시되지 않으면 이 예의 지침을 반복하여 구성을 수정합니다.
user@R1# show interfaces fe-1/2/0 { unit 0 { description to_R2; family inet { address 10.0.0.1/30; } } } fe-1/2/2 { unit 0 { description to_R3; family inet { address 10.0.0.5/30; } } } fe-1/2/3 { unit 0 { description to_R4; family inet { address 10.1.0.5/30; } } } fe-1/2/1 { unit 0 { description to_R5; family inet { address 10.0.0.10/30; } } } lo0 { unit 0 { family inet { address 192.168.0.1/32; } } }
user@R1# show protocols bgp { group int { type internal; local-address 192.168.0.1; export [ adv-statics adv-large-aggregates adv-small-aggregates ]; neighbor 192.168.0.2; neighbor 192.168.0.3; } group to_64511 { type external; export adv-large-aggregates; neighbor 10.1.0.6 { peer-as 64511; } } group to_64512 { type external; export [ adv-small-aggregates adv-statics ]; neighbor 10.0.0.9 { peer-as 64512; } } } ospf { area 0.0.0.0 { interface fe-1/2/0.0; interface fe-1/2/2.0; interface lo0.0 { passive; } } }
user@R1# show policy-options policy-statement adv-large-aggregates { term between-16-and-18 { from { protocol aggregate; route-filter 172.16.0.0/16 upto /18; } then accept; } } policy-statement adv-small-aggregates { term between-19-and-24 { from { protocol aggregate; route-filter 172.16.0.0/16 prefix-length-range /19-/24; } then accept; } } policy-statement adv-statics { term statics { from protocol static; then accept; } }
user@R1# show routing-options static { route 172.16.1.16/28 discard; route 172.16.1.32/28 discard; route 172.16.1.48/28 discard; route 172.16.1.64/28 discard; } aggregate { route 172.16.0.0/16; route 172.16.1.0/24; } router-id 192.168.0.1; autonomous-system 64510;
디바이스 구성이 완료되면 구성 모드에서 을(를) 입력합니다 commit
.
확인
구성이 제대로 작동하는지 확인합니다.
디바이스 R4에 대한 경로 보급 확인
목적
디바이스 R1에서 고객 경로가 디바이스 R4에 보급되는지 확인합니다.
실행
user@R1> show route advertising-protocol bgp 10.1.0.6 inet.0: 29 destinations, 31 routes (29 active, 0 holddown, 0 hidden) Prefix Nexthop MED Lclpref AS path * 172.16.0.0/16 Self I * 172.16.2.0/24 Self I * 172.16.2.16/28 Self I * 172.16.2.32/28 Self I * 172.16.2.48/28 Self I * 172.16.2.64/28 Self I * 172.16.3.0/24 Self I * 172.16.3.16/28 Self I * 172.16.3.32/28 Self I * 172.16.3.48/28 Self I * 172.16.3.64/28 Self I
의미
이 adv-large-aggregates
정책은 디바이스 R4와의 피어링 세션에 적용되어 서브넷 마스크 길이가 16비트에서 18비트 사이인 집계 경로를 보급합니다. 172.16.0.0/16 집계 경로는 관리 정책에 의해 정의된 대로 전송되지만 더 큰 서브넷 마스크를 가진 다른 경로도 디바이스 R4로 전송되고 있습니다.
더 긴 경로의 발생 위치 확인
목적
디바이스 R1에서 다른 경로의 위치를 찾습니다.
실행
user@R1> show route 172.16.3.16/28 inet.0: 29 destinations, 31 routes (29 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 172.16.3.16/28 *[BGP/170] 20:16:00, localpref 100, from 192.168.0.3 AS path: I, validation-state: unverified > to 10.0.0.6 via fe-1/2/2.0
의미
디바이스 R1은 디바이스 R3과의 BGP 세션을 통해 이 경로를 학습했습니다. 활성 BGP 경로이기 때문에 BGP 기본 정책에 의해 자동으로 보급됩니다. 기본 정책은 항상 모든 정책 체인의 끝에 적용됩니다. 더 구체적인 경로가 보급되지 않도록 차단하는 정책이 필요합니다.
보다 구체적인 경로 차단
목적
서브넷 마스크 길이가 19비트보다 크거나 같은 172.16.0.0/16 주소 공간 내에서 모든 경로를 거부하는 라는 not-larger-than-18
정책을 생성합니다. 이를 통해 16비트에서 18비트 사이의 마스크로 모든 어그리게이션이 보급되도록 하여 관리 정책의 목표를 달성합니다.
실행
디바이스 R1에서 정책을 구성합니다
not-larger-than-18
.[edit policy-options policy-statement not-larger-than-18 term reject-greater-than-18-bits] user@R1# set from route-filter 172.16.0.0/16 prefix-length-range /19-/32 user@R1# set then reject
디바이스 R1에서 디바이스 R4의 피어링 세션에 정책을 적용합니다.
[edit protocols bgp group to_64511] user@R1# set export not-larger-than-18 user@R1# commit
디바이스 R1에서 디바이스 R4에 보급되는 경로를 확인합니다.
user@R1> show route advertising-protocol bgp 10.1.0.6 inet.0: 29 destinations, 31 routes (29 active, 0 holddown, 0 hidden) Prefix Nexthop MED Lclpref AS path * 172.16.0.0/16 Self I
의미
정책 체인이 올바르게 작동하고 있습니다. 172.16.0.0/16 경로만 디바이스 R4에 보급됩니다.
디바이스 R5에 대한 경로 보급 확인
목적
디바이스 R1에서 고객 경로가 디바이스 R5에 보급되는지 확인합니다.
디바이스 R5는 AS 64512에서 디바이스 R1의 EBGP 피어입니다. 관리 정책에 따르면 이 피어는 길이가 18비트보다 큰 집계 경로와 모든 고객 경로만 수신합니다. 디바이스 R4에서 문제와 유사한 문제가 발생할 것이라는 예상을 바탕으로 마스크 길이가 16비트에서 18비트 사이인 모든 어그리게이션을 거부하는 라는 not-smaller- than-18
정책을 만들 수 있습니다.
실행
디바이스 R2에서 172.16.128.0/17의 총 경로를 구성합니다.
[edit routing-options aggregate] user@R2# set route 172.16.128.0/17 discard user@R2# commit
디바이스 R1에서 디바이스 R5에 보급되는 경로를 확인합니다.
user@R1> show route advertising-protocol bgp 10.0.0.9 inet.0: 30 destinations, 32 routes (30 active, 0 holddown, 0 hidden) Prefix Nexthop MED Lclpref AS path * 172.16.1.0/24 Self I * 172.16.1.16/28 Self I * 172.16.1.32/28 Self I * 172.16.1.48/28 Self I * 172.16.1.64/28 Self I * 172.16.2.0/24 Self I * 172.16.2.16/28 Self I * 172.16.2.32/28 Self I * 172.16.2.48/28 Self I * 172.16.2.64/28 Self I * 172.16.3.0/24 Self I * 172.16.3.16/28 Self I * 172.16.3.32/28 Self I * 172.16.3.48/28 Self I * 172.16.3.64/28 Self I * 172.16.128.0/17 Self I
관리 정책을 위반하여 집계 경로 172.16.128.0/17이 보급됩니다.
디바이스 R1에서 정책을 구성합니다
not-smaller-than-18
.[edit policy-options policy-statement not-smaller-than-18 term reject-less-than-18-bits] user@R1# set from protocol aggregate user@R1# set from route-filter 172.16.0.0/16 upto /18 user@R1# set then reject
디바이스 R1에서 디바이스 R5와의 피어링 세션에 정책을 적용합니다.
[edit protocols bgp group to_64512] user@R1# set export not-smaller-than-18 user@R1# commit
디바이스 R1에서 디바이스 R5에 보급되는 경로를 확인합니다.
user@R1> show route advertising-protocol bgp 10.0.0.9 inet.0: 29 destinations, 31 routes (29 active, 0 holddown, 0 hidden) Prefix Nexthop MED Lclpref AS path * 172.16.1.0/24 Self I * 172.16.1.16/28 Self I * 172.16.1.32/28 Self I * 172.16.1.48/28 Self I * 172.16.1.64/28 Self I * 172.16.2.0/24 Self I * 172.16.2.16/28 Self I * 172.16.2.32/28 Self I * 172.16.2.48/28 Self I * 172.16.2.64/28 Self I * 172.16.3.0/24 Self I * 172.16.3.16/28 Self I * 172.16.3.32/28 Self I * 172.16.3.48/28 Self I * 172.16.3.64/28 Self I
의미
정책 체인이 올바르게 작동하고 있습니다. 길이가 18비트보다 큰 집계 경로만 집계하며 모든 고객 경로는 디바이스 R5에 보급됩니다.