대상 주소 변환을 사용하려면 풀 주소 공간의 크기가 대상 주소 공간보다 크거나 같아야 합니다. 풀의 destination-pool
NAT 주소 수가 문의 대상 주소 수보다 큰 한 여러 주소 from
, 범위 또는 접두사를 포함할 수 있는 문의 이름을 지정해야 합니다.
IPv4 네트워크에서 대상 주소 변환을 구성하려면 다음과 같이 하십시오.
- 구성 모드에서 계층 수준으로 이동합니다
[edit services]
.
[edit]
user@host# edit services
- 서비스 집합 및 NAT 규칙을 구성합니다.
[edit services]
user@host# set service-set service-set-name nat-rules rule-name
다음 예제에서 서비스 세트의 이름은 s1 이고 NAT 규칙의 이름은 rule-dnat44입니다.
[edit services]
user@host# set service-set s1 nat-rules rule-dnat44
- 서비스 세트의
[interface-service]
계층 수준으로 이동합니다.
[edit services]
user@host# edit service-set s1 interface-service
- 서비스 인터페이스를 구성합니다.
[edit services service-set s1 interface-service]
user@host# set service-interface service-interface-name
다음 예에서 서비스 인터페이스의 이름은 ms-0/1/0입니다.
참고:
서비스 인터페이스가 라우터에 없거나 지정된 인터페이스가 작동하지 않는 경우 다음 명령으로 인해 오류가 발생할 수 있습니다.
[edit services service-set s1 interface-service]
user@host# set service-interface ms-0/1/0
[edit services nat]
계층 수준으로 이동합니다. 서비스 계층의 맨 위에서 다음 명령을 실행하거나 top 키워드를 사용합니다.
[edit services service-set s1]
user@host# top editservices nat
- 주소로 네트워크 주소 변환(NAT) 풀을 구성합니다.
[edit services nat]
user@host# set pool pool-name address address
다음 예에서 dest-pool 은 풀 이름으로, 4.1.1.2 는 주소로 사용됩니다.
user@host# set pool dest-pool address 4.1.1.2
- 규칙, 일치 방향, 용어 및 대상 주소를 구성합니다.
[edit services nat]
user@host# set rule rule-name match-direction match-direction term term-name from destination-address address
다음 예에서 규칙의 이름은 rule-dnat44이고, 일치 방향은 입력이고, 용어의 이름은 t1이고, 주소는 20.20.20.20입니다.
[edit services nat]
user@host# set rule rule-dnat44 match-direction input term t1 from destination-address 20.20.20.20
[edit services nat rule rule-dnat44 term t1]
계층 수준으로 이동합니다.
[edit services nat]
user@host# edit rule rule-dnat44 term t1
- 대상 풀 및 변환 유형을 구성합니다.
[edit services nat rule rule-dnat44 term t1]
user@host# set then translated destination-pool dest-pool-name translation-type translation-type
다음 예제에서 대상 풀 이름은 dest-pool이고 변환 유형은 dnat-44입니다.
[edit services nat rule rule-dnat44 term t1]
user@host# set then translated destination-pool dest-pool translation-type dnat-44
[edit services adaptive-services-pics]
계층 수준으로 이동합니다. 다음 명령에서 top 키워드는 명령이 계층의 맨 위에서 실행되도록 합니다.
[edit services nat rule rule-dnat44 term t1]
user@host# top edit services adaptive-services-pics
- 추적 옵션을 구성합니다.
[edit services adaptive-services-pics]
user@host# set traceoptions flag tracing parameter
다음 예제에서 tracing 매개 변수는 all로 구성됩니다.
[edit services adaptive-services-pics]
user@host# set traceoptions flag all
- 계층 수준에서 명령을
[edit services]
사용하여 show
구성을 확인합니다.
[edit services]
user@host# show
service-set s1 {
nat-rules rule-dnat44;
interface-service {
service-interface ms-0/1/0;
}
}
nat {
pool dest-pool {
address 4.1.1.2/32;
}
rule rule-dnat44 {
match-direction input;
term t1 {
from {
destination-address {
20.20.20.20/32;
}
}
then {
translated {
destination-pool dest-pool;
translation-type {
dnat-44;
}
}
}
}
}
}
adaptive-services-pics {
traceoptions {
flag all;
}
}
다음 예에서는 변환 유형을 dnat-44로 구성합니다.
[edit services]
user@host# show
service-set s1 {
nat-rules rule-dnat44;
interface-service {
service-interface ms-0/1/0;
}
}
nat {
pool dest-pool {
address 4.1.1.2/32;
}
rule rule-dnat44 {
match-direction input;
term t1 {
from {
destination-address {
20.20.20.20/32;
}
}
then {
translated {
destination-pool dest-pool;
translation-type {
dnat-44;
}
}
}
}
}
}
adaptive-services-pics {
traceoptions {
flag all;
}
}
다음 구성에서 term1 은 개인 주소에서 공용 주소로의 트래픽에 대한 소스 주소 변환을 구성합니다. 번역은 모든 서비스에 적용됩니다. term2 는 공용 주소에서 서버의 가상 IP 주소로의 HTTP(Hypertext Transfer Protocol) 트래픽에 대한 대상 주소 변환을 수행합니다. 가상 서버 IP 주소가 내부 IP 주소로 변환됩니다.
[edit services nat]
rule my-nat-rule {
match-direction input;
term my-term1 {
from {
source-address private;
destination-address public;
}
then {
translated {
source-pool my-pool; # pick address from a pool
translation-type napt-44; # dynamic NAT with port translation
}
}
}
}
rule my-nat-rule2 {
match-direction input;
term my-term2 {
from {
destination-address 192.168.137.3; # my server’s virtual address
application http;
}
then {
translated {
destination-pool nat-pool-name;
translation-type dnat-44; # static destination NAT
}
}
}
}
}
다음 구성은 풀을 정의하지 않고 대상 접두사 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;
}
}
}
}