動的アドレスのみのソース変換
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-DPCを搭載したMXシリーズルーターと、MS-100、MS-400、MS-500マルチサービスPICを搭載したM Seriesルーターでサポートされています。no-translation オプションは、リリース 15.1R1 以降の MS-MPC および MS-MIC を搭載した MXシリーズ ルーター Junos OSサポートされています。
[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)の一部として設定されたアドレスのサブセットを、2 つの個別の静的プール(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;
}
}
}