동적 주소 전용 소스 변환
IPv4 네트워크에서 동적 주소 전용 소스 변환 구성
IPv4 네트워크에서 동적 주소 변환(동적 NAT)은 포트 매핑 없이 대상 트래픽을 동적으로 변환하는 메커니즘입니다. 동적 네트워크 주소 변환(NAT)을 사용하려면 주소 구성을 포함하는 소스 풀 이름을 지정해야 합니다.
IPv4 네트워크에서 동적 NAT를 구성하려면 다음을 수행합니다.
다음 예에서는 변환 유형을 dynamic-nat44로 구성합니다.
[edit services] user@host# show service-set s1 { nat-rules rule-dynamic-nat44; interface-service { service-interface ms-0/1/0; } } nat { pool source-dynamic-pool { address 10.1.1.0/24; } rule rule-dynamic-nat44 { match-direction input; term t1 { from { source-address { 3.1.1.0/24; } } then { translated { destination-pool source-dynamic-pool; translation-type { dynamic-nat44; } } } } } } adaptive-services-pics { traceoptions { flag all; } }
다음 구성은 를 구성하는 no-translation
NAT 규칙 용어 t0
를 제공하여 소스 주소 192.168.20.24/32에서 들어오는 트래픽에 대해 NAT가 수행되지 않도록 지정합니다. 동적 NAT는 NAT 규칙의 용어 t1
에 의해 구성된 대로 다른 모든 수신 트래픽에서 수행됩니다. 이 no-translation
옵션은 MS-DC가 있는 MX 시리즈 라우터와 MS-100, MS-400 및 MS-500 MultiServices PICS가 있는 M 시리즈 라우터에서 지원됩니다. 이 no-translation
옵션은 Junos OS 릴리스 15.1R1부터 MS-MPC 및 MS-MIC가 있는 MX 시리즈 라우터에서 지원됩니다.
[edit services nat] pool my-pool { address-range low 10.10.10.1 high 10.10.10.16; port automatic; } rule src-nat { match-direction input; term t0 { from { source-address 192.168.20.24/32; } then { no-translation; } } term t1 { then { translated { translation-type dynamic-nat44; source-pool my-pool; } } } }
다음 구성은 풀을 정의하지 않고 소스 접두사 20.20.10.0/24 를 사용하여 NAT를 수행합니다.
[edit services nat] rule src-nat { match-direction input; term t1 { then { translation-type dynamic-nat44; source-prefix 20.20.10.0/24; } } }
다음 구성은 풀을 정의하지 않고 대상 접두사 20.20.10.0/32 를 사용하여 NAT를 수행합니다.
[edit services nat] rule src-nat { match-direction input; term t1 { from { destination-address 10.10.10.10/32; then { translation-type dnat44; destination-prefix 20.20.10.0/24; } } } }
예: 다음 홉 서비스로서의 동적 소스 NAT
다음 예는 다음 홉 서비스로 적용된 동적 소스 NAT를 보여줍니다.
[edit interfaces] ge-0/2/0 { unit 0 { family mpls; } } sp-1/3/0 { unit 0 { family inet; } unit 20 { family inet; } unit 32 { family inet; } } [edit routing-instances] protected-domain { interface ge-0/2/0.0; interface sp-1/3/0.20; instance-type vrf; route-distinguisher 10.58.255.17:37; vrf-import protected-domain-policy; vrf-export protected-domain-policy; routing-options { static { route 0.0.0.0/0 next-hop sp-1/3/0.20; } } } [edit policy-options] policy-statement protected-domain-policy { term t1 { then reject; } } [edit services] stateful-firewall { rule allow-all { match-direction input; term t1 { then { accept; } } } } nat { pool my-pool { address 10.58.16.100; port automatic; } rule hide-all { match-direction input; term t1 { then { translated { source-pool my-pool; translation-type napt-44; } } } } } service-set null-sfw-with-nat { stateful-firewall-rules allow-all; nat-rules hide-all; next-hop-service { inside-service-interface sp-1/3/0.20; outside-service-interface sp-1/3/0.32; } }
예: 정적 사용을 위한 동적 풀의 주소 할당
다음 구성은 동적 풀()의 일부로 구성된 주소의 하위 집합을 두 개의 개별 정적 풀(dynamic-pool
static-pool
및 static-pool2
)에 정적으로 할당합니다.
[edit services nat] pool dynamic-pool { address 20.20.10.0/24; } pool static-pool { address-range low 20.20.10.10 high 10.20.10.12; } pool static-pool2 { address 20.20.10.15/32; } rule src-nat { match-direction input; term t1 { from { source-address 30.30.30.0/24; } then { translation-type dynamic-nat44; source-pool dynamic-pool; } } term t2 { from { source-address 10.10.10.2; } then { translation-type basic-nat44; source-pool static-pool; } } term t3 { from { source-address 10.10.10.10; } then { translation-type basic-nat44; source-pool static-pool2; } } }