NAT設定の概要
このトピックでは、ネットワークアドレス変換(NAT)と複数のISPを設定する方法について説明します。また、このトピックは、トレース オプションを設定し、テーブルNAT監視することにより、NAT トラフィックを検証するのに役立ちます。
NAT ウィザードを使用した NAT の設定
NATウィザードを使用して、基本的なNAT設定を実行できます。より高度な設定を実行するには、J-WebインターフェイスまたはCLIを使用します。
NAT ウィザードを使用して NAT を設定するには:
- J-Webインターフェイスで
Configure>Tasks>Configure NATを選択します。 - [Launch NAT Wizard](ウィザードの起動)ボタンをクリックします。
- ウィザードのプロンプトに従います。
ウィザードページの左上のエリアは、構成プロセスの進捗を示しています。ページの左下のエリアには、フィールドに対応するヘルプが表示されます。リソース見出しの下のリンクをクリックすると、ブラウザーでドキュメントが開きます。ドキュメントが新しいタブで開いた場合は、ドキュメントを閉じる際、(ブラウザー ウィンドウではなく)タブのみを閉じるようにしてください。
例:複数のISPのNATの設定
この例では、複数のISPのアドレス変換用にジュニパーネットワークスデバイスを設定する方法を示しています。
要件
始める前に:
デバイス上のネットワークインターフェイスを設定します。 セキュリティデバイス向けインターフェイスユーザーガイドを参照してください。
セキュリティゾーンを作成し、インターフェイスを割り当てます。 「セキュリティゾーンについて」を参照してください。
概要
この例では、2つのISP接続を介してNAT機能を使用してLANをインターネットに接続することで、SRXシリーズファイアウォールを設定できます。この設定では、trustはプライベートアドレス空間のセキュリティゾーンであり、パブリックアドレス空間の2つのuntrustセキュリティゾーンは、LANから2つのISPへの接続(またはその逆)に使用されます。この例は、LAN からインターネットに接続するための送信元 NAT ルールと、インターネットから LAN に接続するための宛先 NAT ルールと静的 NAT ルールの組み合わせです。
設定
複数のISPのNATの設定
CLIクイックコンフィグレーション
この例を迅速に設定するには、以下のコマンドをコピーしてテキストファイルに貼り付け、改行を削除し、ネットワーク設定に一致させる必要がある詳細情報を変更し、[ edit] 階層レベルでコマンドをCLIにコピーアンドペーストして、設定モードから commit を入力します。
set routing-instances isp1 instance-type virtual-router set routing-instances isp1 interface ge-0/0/2.0 set routing-instances isp1 routing-options static route 10.0.0.0/8 next-table inet.0 set routing-instances isp1 routing-options static route 0.0.0.0/0 next-hop 192.0.2.20 set routing-instances isp2 instance-type virtual-router set routing-instances isp2 interface ge-0/0/3.0 set routing-instances isp2 routing-options static route 10.0.0.0/8 next-table inet.0 set routing-instances isp2 routing-options static route 0.0.0.0/0 next-hop 198.51.100.251 set routing-options interface-routes rib-group inet isp set routing-options static route 10.0.0.0/8 next-hop 10.0.21.254 set routing-options rib-groups isp import-rib inet.0 set routing-options rib-groups isp import-rib isp1.inet.0 set routing-options rib-groups isp import-rib isp2.inet.0 set security policies from-zone trust to-zone untrust1 policy tr-untr1-pol match source-address any set security policies from-zone trust to-zone untrust1 policy tr-untr1-pol match destination-address any set security policies from-zone trust to-zone untrust1 policy tr-untr1-pol match application any set security policies from-zone trust to-zone untrust1 policy tr-untr1-pol then permit set security policies from-zone trust to-zone untrust2 policy tr-untr2-pol match source-address any set security policies from-zone trust to-zone untrust2 policy tr-untr2-pol match destination-address any set security policies from-zone trust to-zone untrust2 policy tr-untr2-pol match application any set security policies from-zone trust to-zone untrust2 policy tr-untr2-pol then permit set security policies from-zone untrust1 to-zone untrust2 policy untr1-untr2-pol match source-address any set security policies from-zone untrust1 to-zone untrust2 policy untr1-untr2-pol match destination-address any set security policies from-zone untrust1 to-zone untrust2 policy untr1-untr2-pol match application any set security policies from-zone untrust1 to-zone untrust2 policy untr1-untr2-pol then reject set security policies from-zone untrust2 to-zone untrust1 policy untr2-untr1-pol match source-address any set security policies from-zone untrust2 to-zone untrust1 policy untr2-untr1-pol match destination-address any set security policies from-zone untrust2 to-zone untrust1 policy untr2-untr1-pol match application any set security policies from-zone untrust2 to-zone untrust1 policy untr2-untr1-pol then reject set security policies from-zone untrust1 to-zone trust policy untr1-tr-pol match source-address any set security policies from-zone untrust1 to-zone trust policy untr1-tr-pol match destination-address ftp-ser set security policies from-zone untrust1 to-zone trust policy untr1-tr-pol match destination-address telnet-ser set security policies from-zone untrust1 to-zone trust policy untr1-tr-pol match application junos-ftp set security policies from-zone untrust1 to-zone trust policy untr1-tr-pol match application junos-telnet set security policies from-zone untrust1 to-zone trust policy untr1-tr-pol then permit set security policies from-zone untrust2 to-zone trust policy untr2-tr-pol match source-address any set security policies from-zone untrust2 to-zone trust policy untr2-tr-pol match destination-address 10.171.9.23/32 set security policies from-zone untrust2 to-zone trust policy untr2-tr-pol match destination-address http-ser set security policies from-zone untrust2 to-zone trust policy untr2-tr-pol match destination-address 10.103.12.0/24 set security policies from-zone untrust2 to-zone trust policy untr2-tr-pol match application junos-http set security policies from-zone untrust2 to-zone trust policy untr2-tr-pol match application junos-icmp-all set security policies from-zone untrust2 to-zone trust policy untr2-tr-pol match application junos-dhcp-server set security policies from-zone untrust2 to-zone trust policy untr2-tr-pol then permit set security nat source pool pool_1 address 192.0.2.40/32 to 192.0.2.190/32 set security nat source pool pool_2 address 192.0.2.250/32 set security nat source pool pool_3 address 198.51.100.20/32 to 198.51.100.30/32 set security nat source address-persistent set security nat source pool-utilization-alarm raise-threshold 90 set security nat source pool-utilization-alarm clear-threshold 80 set security nat source rule-set SR_SET_1 from zone trust set security nat source rule-set SR_SET_1 to zone untrust1 set security nat source rule-set SR_SET_1 rule rule1 match source-address 10.11.0.0/16 set security nat source rule-set SR_SET_1 rule rule1 match source-address 10.147.0.0/16 set security nat source rule-set SR_SET_1 rule rule1 match destination-address 0.0.0.0/0 set security nat source rule-set SR_SET_1 rule rule1 then source-nat pool pool_1 set security nat source rule-set SR_SET_1 rule rule2 match source-address 10.148.1.0/27 set security nat source rule-set SR_SET_1 rule rule2 match destination-address 0.0.0.0/0 set security nat source rule-set SR_SET_1 rule rule2 then source-nat interface set security nat source rule-set SR_SET_2 from zone trust set security nat source rule-set SR_SET_2 to zone untrust2 set security nat source rule-set SR_SET_2 rule rule3 match source-address 10.140.21.0/27 set security nat source rule-set SR_SET_2 rule rule3 then source-nat pool pool_3 set security nat source rule-set SR_SET_2 rule rule4 match source-address 10.150.45.0/24 set security nat source rule-set SR_SET_2 rule rule4 then source-nat off set security nat destination pool dppol_1 address 10.101.1.10/32 set security nat destination pool dppol_1 address port 21 set security nat destination pool dppol_2 address 10.101.1.11/32 set security nat destination pool dppol_2 address port 2101 set security nat destination pool dppol_3 address 10.103.12.251/32 set security nat destination pool dppol_3 address port 23 set security nat destination pool dppol_4 address 10.103.12.241/32 set security nat destination pool dppol_4 address port 23 set security nat destination pool dppol_5 address 10.103.1.11/32 set security nat destination pool dppol_5 address port 22 set security nat destination rule-set DR_SET1 from routing-instance isp1 set security nat destination rule-set DR_SET1 rule rule1 match destination-address 192.168.0.10/32 set security nat destination rule-set DR_SET1 rule rule1 match destination-port 7230 set security nat destination rule-set DR_SET1 rule rule1 then destination-nat pool dppol_1 set security nat destination rule-set DR_SET1 rule rule2 match destination-address 192.169.1.0/24 set security nat destination rule-set DR_SET1 rule rule2 then destination-nat pool dppol_2 set security nat destination rule-set DR_SET2 from routing-instance isp2 set security nat destination rule-set DR_SET2 rule rule3 match destination-address 192.168.2.2/32 set security nat destination rule-set DR_SET2 rule rule3 match destination-port 7351 set security nat destination rule-set DR_SET2 rule rule3 then destination-nat pool dppol_3 set security nat destination rule-set DR_SET2 rule rule4 match destination-address 192.168.4.171/32 set security nat destination rule-set DR_SET2 rule rule4 match destination-port 3451 set security nat destination rule-set DR_SET2 rule rule4 then destination-nat pool dppol_4 set security nat static rule-set ST_SET1 from zone trust set security nat static rule-set ST_SET1 rule rule1 match destination-address 10.0.10.0/24 set security nat static rule-set ST_SET1 rule rule1 then static-nat prefix 192.168.5.0/24 set security nat static rule-set ST_SET2 from routing-instance isp1 set security nat static rule-set ST_SET2 rule rule2 match destination-address 192.168.6.0/24 set security nat static rule-set ST_SET2 rule rule2 then static-nat prefix 10.107.30.0/24 set security nat static rule-set ST_SET2 rule rule3 match destination-address 192.168.0.10/32 set security nat static rule-set ST_SET2 rule rule3 then static-nat prefix 10.171.9.23/32
ステップバイステップの手順
次の例では、設定階層のさまざまなレベルに移動する必要があります。その方法の詳細については、『Junos OS CLIユーザーガイド』の「 構成モードでのCLIエディターの使用 」を参照してください。
ルーティングインスタンスを設定します。
[edit ] user@host# set routing-instances isp1 instance-type virtual-router user@host# set routing-instances isp1 interface ge-0/0/2.0 user@host# set routing-instances isp1 routing-options static route 10.0.0.0/8 next-table inet.0 user@host# set routing-instances isp1 routing-options static route 0.0.0.0/0 next-hop 192.0.2.20 user@host# set routing-instances isp2 instance-type virtual-router user@host# set routing-instances isp2 interface ge-0/0/3.0 user@host# set routing-instances isp2 routing-options static route 10.0.0.0/8 next-table inet.0 user@host# set routing-instances isp2 routing-options static route 0.0.0.0/0 next-hop 198.51.100.251
RIBグループとルーティングオプションを設定します。
[edit ] user@host# set routing-options interface-routes rib-group inet isp user@host# set routing-options static route 10.0.0.0/8 next-hop 10.0.21.254 user@host# set routing-options rib-groups isp import-rib inet.0 user@host# set routing-options rib-groups isp import-rib isp1.inet.0 user@host# set routing-options rib-groups isp import-rib isp2.inet.0
セキュリティポリシーを設定します。
[edit security policies] user@host# set from-zone trust to-zone untrust1 policy tr-untr1-pol match source-address any user@host# set from-zone trust to-zone untrust1 policy tr-untr1-pol match destination-address any user@host# set from-zone trust to-zone untrust1 policy tr-untr1-pol match application any user@host# set from-zone trust to-zone untrust1 policy tr-untr1-pol then permit user@host# set from-zone trust to-zone untrust2 policy tr-untr2-pol match source-address any user@host# set from-zone trust to-zone untrust2 policy tr-untr2-pol match destination-address any user@host# set from-zone trust to-zone untrust2 policy tr-untr2-pol match application any user@host# set from-zone trust to-zone untrust2 policy tr-untr2-pol then permit user@host# set from-zone untrust1 to-zone untrust2 policy untr1-untr2-pol match source-address any user@host# set from-zone untrust1 to-zone untrust2 policy untr1-untr2-pol match destination-address anyfrom-zone untrust1 to-zone untrust2 policy untr1-untr2-pol match destination-address any user@host# set from-zone untrust1 to-zone untrust2 policy untr1-untr2-pol match application any user@host# set from-zone untrust1 to-zone untrust2 policy untr1-untr2-pol then reject user@host# set from-zone untrust2 to-zone untrust1 policy untr2-untr1-pol match source-address any user@host# set from-zone untrust2 to-zone untrust1 policy untr2-untr1-pol match destination-address any user@host# set from-zone untrust2 to-zone untrust1 policy untr2-untr1-pol match application any user@host# set from-zone untrust2 to-zone untrust1 policy untr2-untr1-pol then reject user@host# set from-zone untrust1 to-zone trust policy untr1-tr-pol match source-address any user@host# set from-zone untrust1 to-zone trust policy untr1-tr-pol match destination-address ftp-ser user@host# set from-zone untrust1 to-zone trust policy untr1-tr-pol match destination-address telnet-ser user@host# set from-zone untrust1 to-zone trust policy untr1-tr-pol match application junos-ftp user@host# set from-zone untrust1 to-zone trust policy untr1-tr-pol match application junos-telnet user@host# set from-zone untrust1 to-zone trust policy untr1-tr-pol then permit user@host# set from-zone untrust2 to-zone trust policy untr2-tr-pol match source-address any user@host# set from-zone untrust2 to-zone trust policy untr2-tr-pol match destination-address 10.171.9.23/32 user@host# set from-zone untrust2 to-zone trust policy untr2-tr-pol match destination-address http-ser user@host# set from-zone untrust2 to-zone trust policy untr2-tr-pol match destination-address 10.103.12.0/24 user@host# set from-zone untrust2 to-zone trust policy untr2-tr-pol match application junos-http user@host# set from-zone untrust2 to-zone trust policy untr2-tr-pol match application junos-icmp-all user@host# set from-zone untrust2 to-zone trust policy untr2-tr-pol match application junos-dhcp-server user@host# set from-zone untrust2 to-zone trust policy untr2-tr-pol then permit
ソースNATプールとルールを設定します。
[edit security nat] user@host# set source pool pool_1 address 192.0.2.40/32 to 192.0.2.190/32 user@host# set source pool pool_2 address 192.0.2.250/32 user@host# set source pool pool_3 address 198.51.100.20/32 to 198.51.100.30/32 user@host# set source address-persistent user@host# set source pool-utilization-alarm raise-threshold 90 user@host# set source pool-utilization-alarm clear-threshold 80 user@host# set source rule-set SR_SET_1 from zone trust user@host# set source rule-set SR_SET_1 to zone untrust1 user@host# set source rule-set SR_SET_1 rule rule1 match source-address 10.11.0.0/16 user@host# set source rule-set SR_SET_1 rule rule1 match source-address 10.147.0.0/16 user@host# set source rule-set SR_SET_1 rule rule1 match destination-address 0.0.0.0/0 user@host# set source rule-set SR_SET_1 rule rule1 then source-nat pool pool_1 user@host# set source rule-set SR_SET_1 rule rule2 match source-address 10.148.1.0/27 user@host# set source rule-set SR_SET_1 rule rule2 match destination-address 0.0.0.0/0 user@host# set source rule-set SR_SET_1 rule rule2 then source-nat interface user@host# set source rule-set SR_SET_2 from zone trust user@host# set source rule-set SR_SET_2 to zone untrust2 user@host# set source rule-set SR_SET_2 rule rule3 match source-address 10.140.21.0/27 user@host# set source rule-set SR_SET_2 rule rule3 then source-nat pool pool_3 user@host# set source rule-set SR_SET_2 rule rule4 match source-address 10.150.45.0/24 user@host# set source rule-set SR_SET_2 rule rule4 then source-nat off
宛先 NAT プールとルールを設定します。
[edit security nat] user@host#set destination pool dppol_1 address 10.101.1.10/32 user@host#set destination pool dppol_1 address port 21 user@host#set destination pool dppol_2 address 10.101.1.11/32 user@host#set destination pool dppol_2 address port 2101 user@host#set destination pool dppol_3 address 10.103.12.251/32 user@host#set destination pool dppol_3 address port 23 user@host#set destination pool dppol_4 address 10.103.12.241/32 user@host#set destination pool dppol_4 address port 23 user@host#set destination pool dppol_5 address 10.103.1.11/32 user@host#set destination pool dppol_5 address port 22 user@host#set destination rule-set DR_SET1 from routing-instance isp1 user@host#set destination rule-set DR_SET1 rule rule1 match destination-address 192.168.0.10/32 user@host#set destination rule-set DR_SET1 rule rule1 match destination-port 7230 user@host#set destination rule-set DR_SET1 rule rule1 then destination-nat pool dppol_1 user@host#set destination rule-set DR_SET1 rule rule2 match destination-address 192.169.1.0/24 user@host#set destination rule-set DR_SET1 rule rule2 then destination-nat pool dppol_2 user@host#set destination rule-set DR_SET2 from routing-instance isp2 user@host#set destination rule-set DR_SET2 rule rule3 match destination-address 192.168.2.2/32 user@host#set destination rule-set DR_SET2 rule rule3 match destination-port 7351 user@host#set destination rule-set DR_SET2 rule rule3 then destination-nat pool dppol_3 user@host#set destination rule-set DR_SET2 rule rule4 match destination-address 192.168.4.171/32 user@host#set destination rule-set DR_SET2 rule rule4 match destination-port 3451 user@host#set destination rule-set DR_SET2 rule rule4 then destination-nat pool dppol_4
静的NATルールを設定します。
[edit security nat] user@host#set static rule-set ST_SET1 from zone trust user@host#set static rule-set ST_SET1 rule rule1 match destination-address 10.0.10.0/24 user@host#set static rule-set ST_SET1 rule rule1 then static-nat prefix 192.168.5.0/24 user@host#set static rule-set ST_SET2 from routing-instance isp1 user@host#set static rule-set ST_SET2 rule rule2 match destination-address 192.168.6.0/24 user@host#set static rule-set ST_SET2 rule rule2 then static-nat prefix 10.107.30.0/24 user@host#set static rule-set ST_SET2 rule rule3 match destination-address 192.168.7.2/32 user@host#set static rule-set ST_SET2 rule rule3 then static-nat prefix 10.171.9.23/32
結果
設定モードから、 show configuration コマンドを入力して設定を確認します。出力に意図した設定が表示されない場合は、この例の設定手順を繰り返して修正します。
user@host# show configuration routing-intances
routing-instances {
isp1 {
instance-type virtual-router;
interface ge-0/0/2.0;
routing-options {
static {
route 10.0.0.0/8 next-table inet.0;
route 0.0.0.0/0 next-hop 192.0.2.20;
}
}
}
isp2 {
instance-type virtual-router;
interface ge-0/0/3.0;
routing-options {
static {
route 10.0.0.0/8 next-table inet.0;
route 0.0.0.0/0 next-hop 198.51.100.251;
}
}
}
}
user@host# show configuration routing-options
routing-options {
interface-routes {
rib-group inet isp;
}
static {
route 10.0.0.0/8 next-hop 10.0.21.254;
}
rib-groups {
isp {
import-rib [ isp1.inet.0 isp2.inet.0 ];
}
}
}
user@host# show configuration policies
policies {
from-zone trust to-zone untrust1 {
policy tr-untr1-pol {
match {
source-address any;
destination-address any;
application any;
}
then {
permit;
}
}
}
from-zone trust to-zone untrust2 {
policy tr-untr2-pol {
match {
source-address any;
destination-address any;
application any;
}
then {
permit;
}
}
}
from-zone untrust1 to-zone untrust2 {
policy untr1-untr2-pol {
match {
source-address any;
destination-address any;
application any;
}
then {
reject;
}
}
}
from-zone untrust2 to-zone untrust1 {
policy untr2-untr1-pol {
match {
source-address any;
destination-address any;
application any;
}
then {
reject;
}
}
}
from-zone untrust1 to-zone trust {
policy untr1-tr-pol {
match {
source-address any;
destination-address [ ftp-ser telnet-ser ];
application [ junos-ftp junos-telnet ];
}
then {
permit;
}
}
}
from-zone untrust2 to-zone trust {
policy untr2-tr-pol {
match {
source-address any;
destination-address [ 10.171.9.23/32 http-ser 10.103.12.0/24 ];
application [ junos-http junos-icmp-all junos-dhcp-server ];
}
then {
permit;
}
}
}
}
user@host# show configuration security nat
security {
nat {
source {
pool pool_1 {
address {
192.0.2.40/32 to 192.0.2.190/32;
}
}
pool pool_2 {
address {
192.0.2.250/32;
}
}
pool pool_3 {
address {
198.51.100.20/32 to 198.51.100.30/32;
}
}
address-persistent;
pool-utilization-alarm raise-threshold 90 clear-threshold 80;
rule-set SR_SET_1 {
from zone trust;
to zone untrust1;
rule rule1 {
match {
source-address [ 10.11.0.0/16 10.147.0.0/16 ];
destination-address 0.0.0.0/0;
}
then {
source-nat {
pool {
pool_1;
}
}
}
}
rule rule2 {
match {
source-address 10.148.1.0/27;
destination-address 0.0.0.0/0;
}
then {
source-nat {
interface;
}
}
}
}
rule-set SR_SET_2 {
from zone trust;
to zone untrust2;
rule rule3 {
match {
source-address 10.140.21.0/27;
}
then {
source-nat {
pool {
pool_3;
}
}
}
}
rule rule4 {
match {
source-address 10.150.45.0/24;
}
then {
source-nat {
off;
}
}
}
}
}
user@host# show configuration security nat
destination {
pool dppol_1 {
address 10.101.1.10/32 port 21;
}
pool dppol_2 {
address 10.101.1.11/32 port 2101;
}
pool dppol_3 {
address 10.103.12.251/32 port 23;
}
pool dppol_4 {
address 10.103.12.241/32 port 23;
}
pool dppol_5 {
address 10.103.1.11/32 port 22;
}
rule-set DR_SET1 {
from routing-instance isp1;
rule rule1 {
match {
destination-address 192.168.0.10/32;
destination-port 7230;
}
then {
destination-nat pool dppol_1;
}
}
rule rule2 {
match {
destination-address 192.169.1.0/24;
}
then {
destination-nat pool dppol_2;
}
}
}
rule-set DR_SET2 {
from routing-instance isp2;
rule rule3 {
match {
destination-address 192.168.2.2/32;
destination-port 7351;
}
then {
destination-nat pool dppol_3;
}
}
rule rule4 {
match {
destination-address 192.168.4.171/32;
destination-port 3451;
}
then {
destination-nat pool dppol_4;
}
}
}
}
user@host# show configuration static nat
static {
rule-set ST_SET1 {
from zone trust;
rule rule1 {
match {
destination-address 10.0.10.0/24;
}
then {
static-nat prefix 192.168.5.0/24;
}
}
}
rule-set ST_SET2 {
from routing-instance isp1;
rule rule2 {
match {
destination-address 192.168.6.0/24;
}
then {
static-nat prefix 10.107.30.0/24;
}
}
rule rule3 {
match {
destination-address 192.168.7.2/32;
}
then {
static-nat prefix 10.171.9.23/32;
}
}
}
}
}
デバイスの設定が完了したら、設定モードから commit を入力します。
NAT用のプロキシARPの設定(CLI手順)
NATプロキシARP機能を使用して、送信元または宛先NATを必要とし、イングレスインターフェイスと同じサブネット内にあるIPアドレスのNATプロキシARPエントリーを設定します。SRXシリーズファイアウォールでは、NATプロキシARPを明示的に設定する必要があります。
NATプロキシARPを設定する場合、プロキシARPを設定する論理インターフェイスを指定する必要があります。次に、アドレスまたはアドレス範囲を入力します。
デバイスは、以下の条件に対してプロキシARPを実行します。
静的NATと送信元NATプールで定義されたアドレスが、イングレスインターフェイスと同じサブネット内にある場合
宛先 NAT ルールの元の宛先アドレス エントリーのアドレスが、イングレス インターフェイスのアドレスと同じサブネット内にある場合
user@host# set security nat proxy-arp interface fe-0/0/0.0 address 10.1.1.10 to 10.1.1.20
NATトレースオプションの設定
目的
NATトレースオプション階層は、検証目的でトレースファイルとフラグを設定します。
SRXシリーズファイアウォールには、ルーティングエンジン(RE)とパケット転送エンジン(PFE)の2つの主要コンポーネントがあります。PFE は、ukernel 部分とリアルタイム部分に分かれています。
NAT設定がコミットされると、まずRE上で設定をチェックして検証します。検証後、設定がPFEにプッシュされます。設定がukernel PFEにインストールされ、リアルタイムPFEのNATルールに一致する各パケットに対してアクションが実行されます。
検証のために、フラグを個別にオンにして、RE、ukernel PFE、またはリアルタイム PFE の NAT 機能をデバッグできます。
nat-reフラグは、RE での NAT 設定検証のトレースと PFE への設定プッシュを記録します。nat-pfeフラグは、ukernel PFE でのNAT設定インストールのトレースを記録します。nat-rtフラグは、リアルタイム PFE に対する NAT ルール一致と後続のアクションのトレースを記録します。
トレースデータはデフォルトで /var/log/security-trace に書き込まれ、コマンド show log security-traceを使用して表示できます。
デバイスのポリシー設定でセッションログが有効になっている場合、セッションログには各セッションの特定のNATの詳細が含まれます。セッションログを有効にする方法については セキュリティポリシー統計の監視 を、セッションログで提供される情報については、 SRXシリーズサービスゲートウェイのセッションログエントリで提供される情報 を参照してください。
アクション
コミット時にNAT設定がデバイスに正しく更新され、NATルールの一致と後続のアクションが正しいことを確認するには、 security nat traceoptions ステートメントを使用します。
user@host# set security nat traceoptions flag all user@host# set security nat traceoptions flag destination-nat-pfe user@host# set security nat traceoptions flag destination-nat-re user@host# set security nat traceoptions flag destination-nat-rti user@host# set security nat traceoptions flag source-nat-pfe user@host# set security nat traceoptions flag source-nat-re user@host# set security nat traceoptions flag source-nat-rt user@host# set security nat traceoptions flag static-nat-pfe user@host# set security nat traceoptions flag static-nat-re user@host# set security nat traceoptions flag static-nat-rt
NAT変換がトラフィックに適用されていることを確認し、NAT変換を含む個々のトラフィックフロー処理を表示するには、security nat traceoptionsコマンドとsecurity flow traceoptionsコマンドの両方を一緒に使用します。コマンドも設定しないflow traceoptions限り、security nat traceoptionsコマンドで設定されたNATトレースは記録されないため、コマンドが一緒に使用されます。
特定のフローをフィルタリングするには、パケット フィルターを定義し、それを traceoption として使用できます。
user@host# set security flow traceoptions packet-filter packet-filter user@host# set security flow traceoptions packet-filter packet-filter apply-groups user@host# set security flow traceoptions packet-filter packet-filter apply-groups-except user@host# set security flow traceoptions packet-filter packet-filter destination-port user@host# set security flow traceoptions packet-filter packet-filter destination-prefix user@host# set security flow traceoptions packet-filter packet-filter interface user@host# set security flow traceoptions packet-filter packet-filter protocol user@host# set security flow traceoptions packet-filter packet-filter source-port user@host# set security flow traceoptions packet-filter packet-filter source-prefix
NATトラフィックを検証し、データプレーンですべてのトラフィックトレースを有効にするには、単純なパケットフィルターを使用した次の例に示すように、traceoptions set security flow traceoptions flag basic-datapath コマンドを使用します。
user@host# set security flow traceoptions file filename user@host# set security flow traceoptions flag basic-datapath user@host# set security flow traceoptions packet-filter client-traffic source-prefixprefix user@host# set security flow traceoptions packet-filter client-traffic destination-prefixprefix user@host# set security nat traceoptions flag all
NAT着信テーブル情報の監視
目的
NATテーブル情報を表示します。
アクション
J-Webユーザーインターフェイスで 監視>NAT>受信テーブル を選択するか、以下のCLIコマンドを入力します。
show security nat incoming-table
表1 は、受信テーブル表示における主要な出力フィールドをまとめたものです。
フィールド |
価値 |
|---|---|
| 統計情報 | |
使用中 |
NATテーブル内のエントリー数。 |
最大値 |
NATテーブルで入力可能な最大エントリー数。 |
エントリーの割り当てに失敗しました |
割り当てに失敗したエントリー数。 |
| 受信テーブル | |
クリア |
|
宛先 |
宛先IPアドレスとポート番号。 |
司会 |
宛先IPアドレスがマッピングされているホストIPアドレスとポート番号。 |
参考文献 |
エントリーを参照するセッションの数。 |
タイムアウト |
NATテーブル内のエントリのタイムアウト(秒単位)。 |
ソースプール |
変換が割り当てられるソースプールの名前。 |
インターフェイス NAT ポート情報の監視
目的
インターフェイス送信元プール情報のポート使用状況を表示します。
アクション
インターフェイスNATポート情報を監視するには、以下のいずれかを実行します。
J-Webユーザーインターフェイスで監視 >ファイアウォール/NAT>インターフェイスNAT または 監視>NAT>インターフェイスNATポート を選択するか、CLIコマンドを入力します
show security nat interface-nat-ports。
表2は 、インターフェイスNAT表示の主要な出力フィールドをまとめたものです。
フィールド |
価値 |
追加情報 |
|---|---|---|
| インターフェイスNATサマリーテーブル | ||
プールインデックス |
ポートプールインデックス。 |
– |
ポート総数 |
ポートプール内のポートの合計数。 |
– |
割り当てられた単一ポート |
使用中のポート数を一度に1つずつ割り当てます。 |
– |
単一のポートが利用可能 |
一度に1つずつ割り当てられ、自由に使用できるポートの数。 |
– |
割り当てられたツインポート |
一度に 2 つ割り当てられ、使用中のポートの数。 |
– |
ツインポートが利用可能 |
一度に 2 つ割り当てられ、自由に使用できるポートの数。 |
– |