귀하의 경험을 개선할 수 있도록 도와주십시오.

귀하의 의견을 알려주십시오.

2분이 소요되는 설문 조사에 시간을 내주시겠습니까?

Announcement: Try the Ask AI chatbot for answers to your technical questions about Juniper products and solutions.

close
header-navigation
keyboard_arrow_up
close
keyboard_arrow_left
list Table of Contents
keyboard_arrow_right

이 기계 번역이 도움이 되었습니까?

starstarstarstarstar
Go to English page
면책 조항:

이 페이지는 타사 기계 번역 소프트웨어를 사용해 번역됩니다. 주니퍼 네트웍스에서는 우수한 품질의 번역을 제공하기 위한 합리적인 수준의 노력을 기울이지만 해당 컨텐츠의 정확성을 보장할 수 없습니다. 본 번역에 포함된 정보의 정확성과 관련해 의문이 있는 경우 영문 버전을 참조하시기 바랍니다. 다운로드 가능한 PDF는 영어로만 제공됩니다.

예: 정책 서브루틴 구성

date_range 19-Jan-25

이 예는 라우팅 정책 일치 조건에서 정책 서브루틴을 사용하는 방법을 보여줍니다.

요구 사항

이 예를 구성하기 전에 디바이스 초기화를 제외한 특별한 구성은 필요하지 않습니다.

개요

디바이스 R1에서 라는 main 정책이 구성됩니다.

content_copy zoom_out_map
user@R1# show policy-options
policy-statement main {
    term subroutine-as-a-match {
        from policy subroutine;
        then accept;
    }
    term nothing-else {
        then reject;
    }
}

이 기본 정책은 라는 서브루틴 subroutine을 호출합니다.

content_copy zoom_out_map
user@R1# show policy-options
policy-statement subroutine {
    term get-routes {
        from protocol static;
        then accept;
    }
    term nothing-else {
        then reject;
    }
}

라우터는 정의된 방식으로 의 main 로직을 평가합니다. 의 일치 기준 from policy subroutine 은 라우팅 디바이스가 서브루틴을 찾을 수 있도록 합니다. 서브루틴의 모든 용어는 일반 정책 처리 규칙에 따라 순서대로 평가됩니다. 이 예에서 라우팅 테이블의 모든 정적 경로는 서브루틴과 일치합니다. 이렇게 하면 원래 또는 호출 정책에 true 결과가 반환되어 디바이스에 긍정적인 일치가 발생했음을 알립니다. 통화 정책의 작업이 실행되고 경로가 수락됩니다. 라우팅 테이블의 다른 모든 경로는 서브루틴과 일치하지 않으며 호출 정책에 잘못된 결과를 반환합니다. 디바이스는 의 두 번째 용어 main 를 평가하고 경로를 거부합니다.

서브루틴의 조치는 실제로 특정 경로를 수락하거나 거부하지 않습니다. 서브루틴 조치는 true 또는 false 결과로만 변환됩니다. 그러나 경로의 속성을 수정하는 작업은 서브루틴의 결과에 관계없이 경로에 적용됩니다.

AS 64510의 디바이스 R1에는 여러 고객 경로가 있으며, 그 중 일부는 로컬로 구성된 정적 경로이고, 일부는 내부 BGP(IBGP)를 통해 디바이스 R2 및 디바이스 R3에서 수신됩니다. AS 64510은 AS 64511의 디바이스 R4에 연결됩니다. 이 정책은 main 디바이스 R4와의 디바이스 R1의 BGP 피어링 세션에서 내보내기 정책으로 적용됩니다. 이로 인해 디바이스 R1은 자체 정적 경로만 디바이스 R4에 전송합니다. 정책 main때문에 디바이스 R1은 내부 피어인 디바이스 R2 및 디바이스 R3에서 수신한 경로를 전송하지 않습니다.

정책 서브루틴에 대해 작업할 때, 기본 EBGP 내보내기 정책은 학습된 모든 BGP 경로를 모든 EBGP 피어에 보급하는 것임을 기억해야 합니다. 이 기본 정책은 기본 정책과 서브루틴에도 적용됩니다. 따라서 이 예에 표시된 것처럼 기본 EBGP 내보내기 정책을 적용하지 않으려면 기본 정책과 정책 서브루틴 모두에서 종료 작업을 최종 용어로 구성해야 then reject 합니다. 이 예는 기본 정책 또는 정책 서브루틴에서 최종 then reject 용어가 누락된 경우 발생하는 상황을 보여줍니다.

토폴로지

그림 1은 샘플 네트워크를 표시합니다.

그림 1: 정책 서브루틴에 대한 BGP 토폴로지정책 서브루틴에 대한 BGP 토폴로지

CLI 빠른 구성은(는) 그림 1 내 모든 디바이스의 구성을 보여줍니다.

섹션 #configuration318__policy-subroutine-st은 디바이스 R1의 단계를 설명합니다.

구성

CLI 빠른 구성

이 예를 빠르게 구성하려면, 아래 명령을 복사하여 텍스트 파일로 붙여 넣은 다음 모든 라인브레이크를 제거하고, 네트워크 구성을 일치하는 데 필요한 세부 사항을 바꾸고 [edit] 계층 수준에서 명령을 CLI로 복사해 붙여 넣습니다.

디바이스 R1

content_copy zoom_out_map
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 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 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 main
set protocols bgp group to_64511 neighbor 10.1.0.6 peer-as 64511
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 main term subroutine-as-a-match from policy subroutine
set policy-options policy-statement main term subroutine-as-a-match then accept
set policy-options policy-statement main term nothing-else then reject
set policy-options policy-statement subroutine term get-routes from protocol static
set policy-options policy-statement subroutine term get-routes then accept
set policy-options policy-statement subroutine term nothing-else then reject
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 router-id 192.168.0.1
set routing-options autonomous-system 64510

디바이스 R2

content_copy zoom_out_map
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
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 term 1 from protocol static
set policy-options policy-statement send-static 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 router-id 192.168.0.2
set routing-options autonomous-system 64510

디바이스 R3

content_copy zoom_out_map
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
set protocols bgp group int neighbor 192.168.0.2
set protocols ospf area 0.0.0.0 interface fe-1/2/2.6
set protocols ospf area 0.0.0.0 interface fe-1/2/0.4
set protocols ospf area 0.0.0.0 interface lo0.0 passive
set policy-options policy-statement send-static from protocol static
set policy-options policy-statement send-static 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 router-id 192.168.0.3
set routing-options autonomous-system 64510

디바이스 R4

content_copy zoom_out_map
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

절차

단계별 절차

다음 예는 구성 계층에서 다양한 수준의 탐색이 필요합니다. CLI 탐색에 대한 내용은 Junos OS CLI 사용자 가이드구성 모드에서 CLI 편집기 사용을(를) 참조하십시오.

디바이스 R1 구성

  1. 디바이스 인터페이스를 구성합니다.

    content_copy zoom_out_map
    [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 lo0 unit 0 family inet address 192.168.0.1/32
    
  2. 디바이스 R2 및 디바이스 R3에 대한 내부 BGP(IBGP) 연결을 구성합니다.

    content_copy zoom_out_map
    [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
    
  3. 디바이스 R4에 EBGP 연결을 구성합니다.

    content_copy zoom_out_map
    [edit protocols bgp group to_64511]
    user@R1# set type external
    user@R1# set export main
    user@R1# set neighbor 10.1.0.6 peer-as 64511
    
  4. 디바이스 R2 및 디바이스 R3에 대한 OSPF 연결을 구성합니다.

    content_copy zoom_out_map
    [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
    
  5. 정책 main을(를) 구성합니다.

    content_copy zoom_out_map
    [edit policy-options policy-statement main term subroutine-as-a-match]
    user@R1# set from policy subroutine
    user@R1# set then accept
    [edit policy-options policy-statement main term nothing-else]
    user@R1# set then reject
    
  6. 정책 subroutine을(를) 구성합니다.

    content_copy zoom_out_map
    [edit policy-options policy-statement subroutine term get-routes]
    user@R1# set from protocol static
    user@R1# set then accept
    [edit policy-options policy-statement subroutine term nothing-else]
    user@R1# set then reject
    
  7. 172.16.5.0/24 네트워크에 대한 정적 경로를 구성합니다.

    content_copy zoom_out_map
    [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
    
  8. 자율 시스템(AS) 번호 및 라우터 ID를 구성합니다.

    content_copy zoom_out_map
    [edit routing-options]
    user@R1# set router-id 192.168.0.1
    user@R1# set autonomous-system 64510
    

결과

구성 모드에서 show interfaces, show protocols, show policy-optionsshow routing-options 명령을 입력하여 구성을 확인합니다. 출력 결과가 의도한 구성대로 표시되지 않으면 이 예의 지침을 반복하여 구성을 수정하십시오.

content_copy zoom_out_map
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;
        }
    }
}
lo0 {
    unit 0 {
        family inet {
            address 192.168.0.1/32;
        }
    }
}
content_copy zoom_out_map
user@R1# show protocols
bgp {
    group int {
        type internal;
        local-address 192.168.0.1;
        neighbor 192.168.0.2;
        neighbor 192.168.0.3;
    }
    group to_64511 {
        type external;
        export main;
        neighbor 10.1.0.6 {
            peer-as 64511;
        }
    }
}
ospf {
    area 0.0.0.0 {
        interface fe-1/2/0.0;
        interface fe-1/2/2.0;
        interface lo0.0 {
            passive;
        }
    }
}
content_copy zoom_out_map
user@R1# show policy-options
policy-statement main {
    term subroutine-as-a-match {
        from policy subroutine;
        then accept;
    }
    term nothing-else {
        then reject;
    }
}
policy-statement subroutine {
    term get-routes {
        from protocol static;
        then accept;
    }
    term nothing-else {
        then reject;
    }
}
content_copy zoom_out_map
user@R1# show routing-options
static {
    route 172.6.1.16/28 discard;
    route 172.6.1.32/28 discard;
    route 172.6.1.48/28 discard;
    route 172.6.1.64/28 discard;
}
router-id 192.168.0.1;
autonomous-system 64510;

디바이스 구성을 마쳤으면 구성 모드에서 commit을(를) 입력합니다.

검증

구성이 올바르게 작동하고 있는지 확인합니다.

디바이스 R1에서 경로 확인

목적

디바이스 R1에서 라우팅 테이블의 정적 경로를 확인합니다.

작업

content_copy zoom_out_map
user@R1> show route protocol static

inet.0: 23 destinations, 23 routes (23 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

172.16.1.16/28     *[Static/5] 1d 02:02:13
                      Discard
172.16.1.32/28     *[Static/5] 1d 02:02:13
                      Discard
172.16.1.48/28     *[Static/5] 1d 02:02:13
                      Discard
172.16.1.64/28     *[Static/5] 1d 02:02:13
                      Discard

의미

디바이스 R1에는 4개의 정적 경로가 있습니다.

디바이스 R4에 대한 경로 보급 확인

목적

디바이스 R1에서 정적 경로가 디바이스 R4에 보급되었는지 확인합니다.

작업

content_copy zoom_out_map
user@R1> show route advertising-protocol bgp 10.1.0.6

inet.0: 23 destinations, 23 routes (23 active, 0 holddown, 0 hidden)
  Prefix                  Nexthop              MED     Lclpref    AS path
* 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

의미

예상대로 디바이스 R1은 정적 경로만 디바이스 R4에 보급합니다.

기본 BGP 내보내기 정책 실험

목적

정책 main 또는 정책subroutine에서 최종 then reject 용어를 제거하면 어떻게 되는지 확인합니다.

작업

  1. 디바이스 R1에서 정책의 main마지막 용어를 비활성화합니다.

    content_copy zoom_out_map
    [edit  policy-options policy-statement main]
    user@R1# deactivate term nothing-else
    user@R1# commit
    
  2. 디바이스 R1에서 디바이스 R4에 보급되는 경로를 확인합니다.

    content_copy zoom_out_map
    user@R1> show route advertising-protocol bgp 10.1.0.6
    
    inet.0: 23 destinations, 23 routes (23 active, 0 holddown, 0 hidden)
      Prefix                  Nexthop              MED     Lclpref    AS path
    * 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.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.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

    이제 디바이스 R1의 모든 BGP 경로가 디바이스 R4로 전송됩니다. 이는 처리가 정책 main으로 반환된 후 기본 BGP 내보내기 정책이 적용되기 때문입니다.

  3. 디바이스 R1에서 정책의 main최종 용어를 다시 활성화하고 정책의 subroutine최종 용어를 비활성화합니다.

    content_copy zoom_out_map
    [edit  policy-options policy-statement main]
    user@R1# activate term nothing-else
    
    [edit  policy-options policy-statement subroutine]
    user@R1# deactivate term nothing-else
    user@R1# commit
    
  4. 디바이스 R1에서 디바이스 R4에 보급되는 경로를 확인합니다.

    content_copy zoom_out_map
    user@R1> show route advertising-protocol bgp 10.1.0.6
    
    inet.0: 23 destinations, 23 routes (23 active, 0 holddown, 0 hidden)
      Prefix                  Nexthop              MED     Lclpref    AS path
    * 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.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.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

    이제 디바이스 R1의 모든 BGP 경로가 디바이스 R4로 전송됩니다. 이는 처리가 정책 main으로 반환되기 전에 기본 BGP 내보내기 정책이 정책에 subroutine적용되기 때문입니다.

의미

기본 BGP 내보내기 정책이 적용되지 않도록 하려면 기본 정책 및 참조된 모든 서브루틴에 최종 then reject 용어를 포함해야 합니다.

footer-navigation