Junos OS: Network Address Translation Feature Guide For Security Devices
Junos OS: Network Address Translation Feature Guide For Security Devices
Junos OS: Network Address Translation Feature Guide For Security Devices
Modified: 2019-07-01
Juniper Networks, the Juniper Networks logo, Juniper, and Junos are registered trademarks of Juniper Networks, Inc. in the United States
and other countries. All other trademarks, service marks, registered marks, or registered service marks are the property of their respective
owners.
Juniper Networks assumes no responsibility for any inaccuracies in this document. Juniper Networks reserves the right to change, modify,
transfer, or otherwise revise this publication without notice.
®
Junos OS Network Address Translation Feature Guide for Security Devices
Copyright © 2019 Juniper Networks, Inc. All rights reserved.
The information in this document is current as of the date on the title page.
Juniper Networks hardware and software products are Year 2000 compliant. Junos OS has no known time-related limitations through the
year 2038. However, the NTP application is known to have some difficulty in the year 2036.
The Juniper Networks product that is the subject of this technical documentation consists of (or is intended for use with) Juniper Networks
software. Use of such software is subject to the terms and conditions of the End User License Agreement (“EULA”) posted at
https://support.juniper.net/support/eula/. By downloading, installing or using such software, you agree to the terms and conditions of
that EULA.
If the information in the latest release notes differs from the information in the
documentation, follow the product Release Notes.
Juniper Networks Books publishes books by Juniper Networks engineers and subject
matter experts. These books go beyond the technical documentation to explore the
nuances of network architecture, deployment, and administration. The current list can
be viewed at https://www.juniper.net/books.
If you want to use the examples in this manual, you can use the load merge or the load
merge relative command. These commands cause the software to merge the incoming
configuration into the current candidate configuration. The example does not become
active until you commit the candidate configuration.
If the example configuration contains the top level of the hierarchy (or multiple
hierarchies), the example is a full example. In this case, use the load merge command.
If the example configuration does not start at the top level of the hierarchy, the example
is a snippet. In this case, use the load merge relative command. These procedures are
described in the following sections.
1. From the HTML or PDF version of the manual, copy a configuration example into a
text file, save the file with a name, and copy the file to a directory on your routing
platform.
For example, copy the following configuration to a file and name the file ex-script.conf.
Copy the ex-script.conf file to the /var/tmp directory on your routing platform.
system {
scripts {
commit {
file ex-script.xsl;
}
}
}
interfaces {
fxp0 {
disable;
unit 0 {
family inet {
address 10.0.0.1/24;
}
}
}
}
2. Merge the contents of the file into your routing platform configuration by issuing the
load merge configuration mode command:
[edit]
user@host# load merge /var/tmp/ex-script.conf
load complete
Merging a Snippet
To merge a snippet, follow these steps:
1. From the HTML or PDF version of the manual, copy a configuration snippet into a text
file, save the file with a name, and copy the file to a directory on your routing platform.
For example, copy the following snippet to a file and name the file
ex-script-snippet.conf. Copy the ex-script-snippet.conf file to the /var/tmp directory
on your routing platform.
commit {
file ex-script-snippet.xsl; }
2. Move to the hierarchy level that is relevant for this snippet by issuing the following
configuration mode command:
[edit]
user@host# edit system scripts
[edit system scripts]
3. Merge the contents of the file into your routing platform configuration by issuing the
load merge relative configuration mode command:
For more information about the load command, see CLI Explorer.
Documentation Conventions
Caution Indicates a situation that might result in loss of data or hardware damage.
Laser warning Alerts you to the risk of personal injury from a laser.
Table 2 on page xvi defines the text and syntax conventions used in this guide.
Bold text like this Represents text that you type. To enter configuration mode, type the
configure command:
user@host> configure
Fixed-width text like this Represents output that appears on the user@host> show chassis alarms
terminal screen.
No alarms currently active
Italic text like this • Introduces or emphasizes important • A policy term is a named structure
new terms. that defines match conditions and
• Identifies guide names. actions.
Italic text like this Represents variables (options for which Configure the machine’s domain name:
you substitute a value) in commands or
configuration statements. [edit]
root@# set system domain-name
domain-name
Text like this Represents names of configuration • To configure a stub area, include the
statements, commands, files, and stub statement at the [edit protocols
directories; configuration hierarchy levels; ospf area area-id] hierarchy level.
or labels on routing platform • The console port is labeled CONSOLE.
components.
< > (angle brackets) Encloses optional keywords or variables. stub <default-metric metric>;
# (pound sign) Indicates a comment specified on the rsvp { # Required for dynamic MPLS only
same line as the configuration statement
to which it applies.
[ ] (square brackets) Encloses a variable for which you can community name members [
substitute one or more values. community-ids ]
GUI Conventions
Bold text like this Represents graphical user interface (GUI) • In the Logical Interfaces box, select
items you click or select. All Interfaces.
• To cancel the configuration, click
Cancel.
> (bold right angle bracket) Separates levels in a hierarchy of menu In the configuration editor hierarchy,
selections. select Protocols>Ospf.
Documentation Feedback
We encourage you to provide feedback so that we can improve our documentation. You
can use either of the following methods:
• Online feedback system—Click TechLibrary Feedback, on the lower right of any page
on the Juniper Networks TechLibrary site, and do one of the following:
• Click the thumbs-up icon if the information on the page was helpful to you.
• Click the thumbs-down icon if the information on the page was not helpful to you
or if you have suggestions for improvement, and use the pop-up form to provide
feedback.
Technical product support is available through the Juniper Networks Technical Assistance
Center (JTAC). If you are a customer with an active Juniper Care or Partner Support
Services support contract, or are covered under warranty, and need post-sales technical
support, you can access our tools and resources online or open a case with JTAC.
• JTAC hours of operation—The JTAC centers have resources available 24 hours a day,
7 days a week, 365 days a year.
• Find solutions and answer questions using our Knowledge Base: https://kb.juniper.net/
To verify service entitlement by product serial number, use our Serial Number Entitlement
(SNE) Tool: https://entitlementsearch.juniper.net/entitlementsearch/
• Visit https://myjuniper.juniper.net.
Overview
NAT Overview
Introduction to NAT
Network Address Translation (NAT) is a method for modifying or translating network
address information in packet headers. Either or both source and destination addresses
in a packet may be translated. NAT can include the translation of port numbers as well
as IP addresses.
NAT is described in RFC 1631 to solve IP (version 4) address depletion problems. Since
then, NAT has been found to be a useful tool for firewalls, traffic redirect, load sharing,
network migrations, and so on.
• Static NAT
• Destination NAT
• Source NAT
NOTE: SRX Series devices perform both policy lookup and service lookup
based on the translated destination port.
You can use the NAT Wizard to perform basic NAT configuration. To perform more
advanced configuration, use the J-Web interface or the CLI.
A rule set specifies a general set of matching conditions for traffic. For static NAT and
destination NAT, a rule set specifies one of the following:
• Source interface
• Source zone
For source NAT rule sets, you configure both source and destination conditions:
It is possible for a packet to match more than one rule set; in this case, the rule set with
the more specific match is used. An interface match is considered more specific than a
zone match, which is more specific than a routing instance match. If a packet matches
both a destination NAT rule set that specifies a source zone and a destination NAT rule
set that specifies a source interface, the rule set that specifies the source interface is the
more specific match.
Source NAT rule set matching is more complex because you specify both source and
destination conditions in a source NAT rule set. In the case where a packet matches more
than one source NAT rule set, the rule set chosen is based on the following
source/destination conditions (in order of priority):
For example, you can configure rule set A, which specifies a source interface and a
destination zone, and rule set B, which specifies a source zone and a destination interface.
If a packet matches both rule sets, rule set B is the more specific match.
NOTE: You cannot specify the same source and destination conditions for
source NAT rule sets.
NAT Rules
Once a rule set that matches the traffic has been found, each rule in the rule set is
evaluated in order for a match. NAT rules can match on the following packet information:
• Destination port
The first rule in the rule set that matches the traffic is used. If a packet matches a rule in
a rule set during session establishment, traffic is processed according to the action
specified by that rule.
You can use the show security nat source rule and show security nat destination rule and
the show security nat static rule commands to view the number of sessions for a specific
rule.
Rule Processing
The NAT type determines the order in which NAT rules are processed. During the first
packet processing for a flow, NAT rules are applied in the following order:
3. Route lookup
Static NAT and destination NAT rules are processed before route and security policy
lookup. Static NAT rules take precedence over destination NAT rules. Reverse mapping
of static NAT rules takes place after route and security policy lookup and takes precedence
over source NAT rules. Source NAT rules are processed after route and security policy
lookup and after reverse mapping of static NAT rules.
The configuration of rules and rule sets is basically the same for each type of NAT—source,
destination, or static. But because both destination and static NAT are processed before
route lookup, you cannot specify the destination zone, interface or routing instance in
the rule set.
Table 3 on page 23 provides the NAT rule capacity requirements per device. Platform
support depends on the Junos OS release in your installation.
SRX5400
NAT Rule SRX300 SRX340 SRX4100 SRX5600
Type SRX100 SRX320 SRX345 SRX1500 SRX4200 SRX4600 SRX5800
The restriction on the number of rules per rule set is a device-wide limitation on how
many rules a device can support. This restriction is provided to help you better plan and
configure the NAT rules for the device.
Table 4 on page 23 provides the recommended maximum number of rules and rule sets
for SRX3400, SRX3600, SRX5400, SRX5600, and SRX5800 devices. Platform support
depends on the Junos OS release in your installation.
SRX5400
SRX3400 SRX5600
Objects SRX3600 SRX4600 SRX5800
This topic describes how to configure Network Address Translation (NAT) and multiple
ISPs. Also, this topic helps to verify the NAT traffic by configuring the trace options and
monitoring NAT table.
The upper-left area of the wizard page shows where you are in the configuration process.
The lower-left area of the page shows field-sensitive help. When you click a link under
the Resources heading, the document opens in your browser. If the document opens in
a new tab, be sure to close only the tab (not the browser window) when you close the
document.
• Requirements on page 25
• Overview on page 25
• Configuration on page 25
• Verification on page 36
Requirements
1. Configure network interfaces on the device. See Interfaces Feature Guide for Security
Devices.
2. Create security zones and assign interfaces to them. See Understanding Security Zones.
Overview
In this example, you can configure an SRX Series Services Gateway by connecting the
LAN to the Internet by using NAT feature through two ISP connections. In this
configuration, trust is the security zone for the private address space and the two untrust
security zones for the public address space are used to connect from LAN to the two
ISPs and vice versa. The example is a combination of source NAT rules to connect to
Internet from the LAN, and destination and static NAT rules to connect to the LAN from
Internet.
Configuration
CLI Quick To quickly configure this example, copy the following commands, paste them into a text
Configuration file, remove any line breaks, change any details necessary to match your network
configuration, copy and paste the commands into the CLI at the [edit] hierarchy level,
and then enter commit from configuration mode.
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
Step-by-Step The following example requires you to navigate various levels in the configuration
Procedure hierarchy. For instructions on how to do that, see Using the CLI Editor in Configuration
Mode in the Junos OS CLI User Guide.
[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
[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
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
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
Results From configuration mode, confirm your configuration by entering show configuration
command. If the output does not display the intended configuration, repeat the
configuration instructions in this example to correct it.
}
}
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;
}
}
}
}
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;
}
}
}
}
}
If you are done configuring the device, enter commit from configuration mode.
Verification
Verifying Interfaces
• show interfaces
• show zones
• show routing-instances
• show routing-options
• show policies
NOTE: On SRX Series devices, you must explicitly configure NAT proxy ARP.
When configuring NAT proxy ARP, you must specify the logical interface on which to
configure proxy ARP. Then you enter an address or address range.
• When addresses defined in the static NAT and source NAT pool are in the same subnet
as that of the ingress interface
• When addresses in the original destination address entry in the destination NAT rules
are in the same subnet as that of the ingress interface
user@host# set security nat proxy-arp interface fe-0/0/0.0 address 10.1.1.10 to 10.1.1.20
Purpose The NAT trace options hierarchy configures trace file and flags for verification purposes.
SRX Series devices have two main components: the Routing Engine (RE) and the Packet
Forwarding Engine (PFE). The PFE is divided into the ukernel portion and the real-time
portion.
When a NAT configuration is committed, the configuration is first checked and validated
on the RE. After validation, the configuration is pushed to the PFE. The configuration is
installed on the ukernel PFE, then action is taken on each packet that matches NAT rules
on the real-time PFE.
For verification, you can turn on flags individually to debug NAT functionality on the RE,
ukernel PFE, or real-time PFE:
• The nat-re flag records the trace of the NAT configuration validation on the RE and the
configuration push to the PFE.
• The nat-pfe flag records the trace of the NAT configuration installation on the ukernel
PFE.
• The nat-rt flag records the trace of the NAT rule match, and subsequent action on the
real-time PFE.
The trace data is written to /var/log/security-trace by default, and can be viewed using
the command show log security-trace.
Action To verify that NAT configurations are correctly updated to the device upon commit, and
that the NAT rule match and subsequent actions are correct, use the security nat
traceoptions statement.
To verify that NAT translations are being applied to the traffic, and to view individual
traffic flow processing with NAT translations, use both the security nat traceoptions
command and the security flow traceoptions command together. The commands are
used together because the NAT trace, configured using the security nat traceoptions
command, is not recorded unless the flow traceoptions command is also configured.
To filter a specific flow, you can define a packet filter and use it as a traceoption :
To verify NAT traffic and to enable all traffic trace in data plane, use the traceoptions set
security flow traceoptions flag basic-datapath command, as shown in the following
example using a simple packet filter:
Action Select Monitor>NAT>Incoming Table in the J-Web user interface, or enter the following
CLI command:
Table 5 on page 39 summarizes key output fields in the incoming table display.
Field Values
Statistics
In use Number of entries in the NAT table.
Incoming Table
Clear
Host Host IP address and port number that the destination IP address is mapped to.
Table 6 on page 40 summarizes key output fields in the interface NAT display.
Twin Ports Number of ports allocated two at a time that are in use. –
Allocated
Twin Ports Number of ports allocated two at a time that are free –
Available for use.
Types of NAT
Source NAT
Source NAT is most commonly used for translating private IP address to a public routable
address to communicate with the host. Source NAT changes the source address of the
packets that pass through the Router. A NAT pool is a set of addresses that are designed
as a replacement for client IP addresses. For more information, see the following topics:
Source NAT allows connections to be initiated only for outgoing network connections—for
example, from a private network to the Internet. Source NAT is commonly used to perform
the following translations:
Translation to the address of the egress interface does not require an address pool; all
other source NAT translations require configuration of an address pool. One-to-one and
many-to-many translations for address blocks of the same size do not require port
translation because there is an available address in the pool for every address that would
be translated.
If the size of the address pool is smaller than the number of addresses that would be
translated, either the total number of concurrent addresses that can be translated is
limited by the size of the address pool or port translation must be used. For example, if
a block of 253 addresses is translated to an address pool of 10 addresses, a maximum
of 10 devices can be connected concurrently unless port translation is used.
• Translation of the original source IP address to the egress interface’s IP address (also
called interface NAT). Port address translation is always performed.
source IP address to the translated source IP address is dynamic. However, once there
is an association, the same association is used for the same original source IP address
for new traffic that matches the same NAT rule.
• The central point architecture no longer supports central point sessions. Therefore,
NAT needs to maintain a NAT tracker to track the IP address or port allocation and
usage. NAT tracker is a global array for SPU session ID to NAT IP or port mapping that
is used to manage NAT resources.
• By default, a NAT rule alarm and trap statistics counter update message is sent from
the Services Processing Unit (SPU) to the central point at intervals of 1 second instead
of updating the statistics based on each session trigger in the central point system.
• To support a specific NAT IP address or port allocated such that the 5-tuple hash after
NAT is the same as the original 5-tuple hash before NAT, select a NAT port that results
in the same hash as the original hash by the specific calculation. Hence, the forwarding
session is reduced. When NAT is used, the reverse wing is hashed to a different SPU.
A forward session has to be installed to forward reverse traffic to a session SPU. NAT
tries to select a port that can be used by the hash algorithm to make the reverse wing
be hashed to the same SPU as the initial wing. So, both NAT performance and
throughput are improved with this approach.
For pool-based source NAT and interface NAT, port randomization mode is enabled and
used by default.
In this mode, the device selects IP addresses on a round-robin basis, and the port selection
is random. That is, when the device performs NAT translation it first chooses the IP
address by round robin, then chooses the port used for that IP address by randomization.
Although randomized port number allocation can provide protection from security threats
such as DNS poison attacks, it can also affect performance and memory usage due to
the computations and NAT table resources involved.
Round-Robin Mode
A less resource-intensive NAT translation method involves using only the round-robin
allocation method. Whereas randomization requires computational work for each assigned
port, the round robin method simply selects ports sequentially.
In this mode, the device selects both IP addresses and ports on a round-robin basis. That
is, when the device performs NAT translation it first chooses the IP address by round
robin, then chooses the port used for that IP address by round robin.
• When the first packet of a flow arrives (creating a session), it is translated to IP1, port
N. Subsequent packets in that flow are allocated to the same IP/port.
• When the first packet of a new flow arrives, it is translated to IP1, port N+1, and so on.
• When the first packet of a flow arrives (creating a session), it is translated to IP1, port
X. Subsequent packets in that flow are allocated to the same IP/port.
• When the first packet of a second flow arrives, it is translated to IP2, port X.
• When the first packet of a third flow arrives, it is translated to IP1, port X+1.
• With the first packets of a fourth flow arrives, it is translated to IP2, port X+1, and so
on.
Configuration
To disable round-robin mode (and re-enable port randomization), delete the configuration
statement, as follows:
Starting in Junos OS Release 15.1X49-D30 and Junos OS Release 17.3R1, you can further
improve NAT performance and throughput on SRX5000 Series devices using “session
affinity” mode.
With the modes noted above, a given session is processed by the inbound SPU based
on a 5-tuple (source IP, dest IP, source port, dest port, protocol) hash. When NAT is
involved, the 5-tuple hash will be different for the outbound part of the session vs. the
return part of the session. Therefore, the outbound NAT session information may be
located in one SPU, while the return (reverse) NAT session information may be located
in another SPU. The goal of session affinity mode is to maintain the forwarding session
information for both the outbound and return traffic on the same SPU.
In this mode, the device uses a “reverse NAT enhancement” translation algorithm for IP
and port selection, to improve performance for NAT sessions and throughput. The NAT
module attempts to select an IP address and port that can be used with the hash
algorithm to ensure the selected SPU for the outbound and return flow elements can be
identical.
Configuration
Session affinity mode is enabled by default, however both port randomization and
round-robin modes (also enabled) have higher priority. To use session affinity mode,
disable both port randomization and round-robin modes, as follows:
To disable session affinity mode, and re-enable either round-robin or port randomization
mode, delete one or both of the configuration statements, as follows:
Usage Notes
• Use large NAT port pools whenever possible (see Security Considerations below)
• The algorithm chooses a port from within the configured port range. If no port is
available, the NAT port will be allocated based on random selection.
Security Considerations
The best way to mitigate the security risk is to ensure the source port number used is less
predictable. That is, the larger the NAT pool resource range from which ephemeral ports
are selected, the smaller the chances of an attacker guessing the selected port number.
Given this, it is recommended to configure large NAT port pools whenever possible.
Purpose Display configured information about source Network Address Translation (NAT) rules,
pools, persistent NAT, and paired addresses.
Action Select Monitor>NAT>Source NAT in the J-Web user interface, or enter the following CLI
commands:
Table 7 on page 46 describes the available options for monitoring source NAT.
Rules
Rule-set Name of the rule set. Select all rule sets or a specific rule set to display from
Name the list.
ID Rule ID number. –
Ip protocol IP protocol. –
Pools
Pool Name The names of the pools. Select all pools or a specific pool to display from the
list.
ID ID of the pool. –
Persistent NAT
enode total Total number of persistent NAT enodes for the FPC. –
Internal Displays the internal ports configured in the system. Select the port to display from the list.
port
Paired Address
Pool name Name of the pool. Select all pools or a specific pool to display from the
list.
Resource Usage
Peak usage Percent of resources used during the peak date and –
time.
a. Specify the name of the pool, the addresses or address ranges, the routing instance,
and whether to perform port address translation (PAT).
c. Configure NAT proxy ARP entries for IP addresses in the same subnet of the ingress
interface.
3. Configure source NAT rules that align with your network and security requirements.
• Requirements on page 52
• Overview on page 52
• Configuration on page 54
• Verification on page 55
Requirements
1. Configure network interfaces on the device. See Interfaces Feature Guide for Security
Devices.
2. Create security zones and assign interfaces to them. See Understanding Security Zones.
Overview
This example uses the trust security zone for the private address space and the untrust
security zone for the public address space. In Figure 2 on page 53, devices with private
addresses in the trust zone access a public network through the egress interface ge-0/0/0.
For packets that enter the Juniper Networks security device from the trust zone with a
destination address in the untrust zone, the source IP address is translated to the IP
address of the egress interface.
NOTE: No source NAT pool is required for source NAT using an egress
interface. Proxy ARP does not need to be configured for the egress interface.
Untrust
zone Internet
Public address
space
ge-0/0/0
SRX Series device 203.0.113.0/24
Private address
space
g030668
• Source NAT rule set rs1 with a rule r1 to match any packet from the trust zone to the
untrust zone. For matching packets, the source address is translated to the IP address
of the egress interface.
• Security policies to permit traffic from the trust zone to the untrust zone.
Configuration
CLI Quick To quickly configure this example, copy the following commands, paste them into a text
Configuration file, remove any line breaks, change any details necessary to match your network
configuration, copy and paste the commands into the CLI at the [edit] hierarchy level,
and then enter commit from configuration mode.
Step-by-Step The following example requires you to navigate throughout various levels in the
Procedure configuration hierarchy. For instructions on how to do that, see Using the CLI Editor in
Configuration Mode.
2. Configure a rule that matches packets and translates the source address to the
address of the egress interface.
3. Configure a security policy that allows traffic from the trust zone to the untrust zone.
Results From configuration mode, confirm your configuration by entering the show security nat
and show security policies commands. If the output does not display the intended
configuration, repeat the configuration instructions in this example to correct it.
[edit]
user@host# show security nat
source {
rule-set rs1 {
from zone trust;
to zone untrust;
rule r1 {
match {
source-address 0.0.0.0/0;
destination-address 0.0.0.0/0;
}
then {
source-nat {
interface;
}
}
}
}
}
user@host# show security policies
from-zone trust to-zone untrust {
policy internet-access {
match {
source-address any;
destination-address any;
application any;
}
then {
permit;
}
}
}
If you are done configuring the device, enter commit from configuration mode.
Verification
Purpose Verify that there is traffic matching the source NAT rule.
Action From operational mode, enter the show security nat source rule all command. View the
Translation hits field to check for traffic that matches the rule.
Action From operational mode, enter the show security flow session command.
• Requirements on page 56
• Overview on page 56
• Configuration on page 58
• Verification on page 60
Requirements
1. Configure network interfaces on the device. See Interfaces Feature Guide for Security
Devices.
2. Create security zones and assign interfaces to them. See Understanding Security Zones.
Overview
This example uses the trust security zone for the private address space and the untrust
security zone for the public address space. In Figure 3 on page 57, a device with the private
address 192.168.1.200 in the trust zone accesses a public network. For packets sent by
the device to a destination address in the untrust zone, the Juniper Networks security
device translates the source IP address to the public IP address 203.0.113.200/32.
Untrust
zone Internet
Public address
space
ge-0/0/0
SRX Series device 203.0.113.0/24
ge-1/0/0
192.168.1.0/24
Trust
zone
Private address 192.168.1.200
space
192.168.1.200/32 203.0.113.200/32
g030669
• Source NAT rule set rs1 with rule r1 to match packets from the trust zone to the untrust
zone with the source IP address 192.168.1.200/32. For matching packets, the source
address is translated to the IP address in src-nat-pool-1 pool.
• Proxy ARP for the address 203.0.113.200 on interface ge-0/0/0.0. This allows the
Juniper Networks security device to respond to ARP requests received on the interface
for that address.
• Security policies to permit traffic from the trust zone to the untrust zone.
Configuration
CLI Quick To quickly configure this example, copy the following commands, paste them into a text
Configuration file, remove any line breaks, change any details necessary to match your network
configuration, copy and paste the commands into the CLI at the [edit] hierarchy level,
and then enter commit from configuration mode.
Step-by-Step The following example requires you to navigate throughout various levels in the
Procedure configuration hierarchy. For instructions on how to do that, see Using the CLI Editor in
Configuration Mode.
3. Configure a rule that matches packets and translates the source address to the
address in the pool.
5. Configure a security policy that allows traffic from the trust zone to the untrust zone.
Results From configuration mode, confirm your configuration by entering the show security nat
and show security policies commands. If the output does not display the intended
configuration, repeat the configuration instructions in this example to correct it.
[edit]
user@host# show security nat
source {
pool src-nat-pool-1 {
address {
203.0.113.200/32;
}
}
rule-set rs1 {
from zone trust;
to zone untrust;
rule r1 {
match {
source-address 192.168.1.200/32;
}
then {
source-nat {
pool {
src-nat-pool-1;
}
}
}
}
}
}
proxy-arp {
interface ge-0/0/0.0 {
address {
203.0.113.200/32;
}
}
}
user@host# show security policies
from-zone trust to-zone untrust {
policy internet-access {
match {
source-address any;
destination-address any;
application any;
}
then {
permit;
}
}
}
If you are done configuring the device, enter commit from configuration mode.
Verification
Purpose Verify that there is traffic using IP addresses from the source NAT pool.
Action From operational mode, enter the show security nat source pool all command. View the
Translation hits field to check for traffic using IP addresses from the pool.
Purpose Verify that there is traffic matching the source NAT rule.
Action From operational mode, enter the show security nat source rule all command. View the
Translation hits field to check for traffic that matches the rule.
Action From operational mode, enter the show security flow session command.
• Requirements on page 61
• Overview on page 61
• Configuration on page 63
• Verification on page 66
Requirements
1. Configure network interfaces on the device. See Interfaces Feature Guide for Security
Devices.
2. Create security zones and assign interfaces to them. See Understanding Security Zones.
Overview
This example uses the trust security zone for the private address space and the untrust
security zone for the public address space. In Figure 4 on page 62, the following
translations are performed on the Juniper Networks security device:
• The source IP address in packets sent by the device with the private address
192.168.1.200 in the trust zone to any address in the untrust zone is translated to a
public address in the range from 203.0.113.10 through 203.0.113.14.
• The destination IP address 203.0.113.100/32 in packets sent from the trust zone to the
untrust zone is translated to the address 10.1.1.200/32.
• Source NAT pool src-nat-pool-1 that contains the IP address range 203.0.113.10 through
203.0.113.14.
• Source NAT rule set rs1 with rule r1 to match any packets from the trust zone to the
untrust zone. For matching packets, the source address is translated to an IP address
in the src-nat-pool-1 pool.
• Destination NAT rule set rs1 with rule r1 to match packets from the trust zone with the
destination IP address 203.0.113.100. For matching packets, the destination address
is translated to the IP address in the dst-nat-pool-1 pool.
• Proxy ARP for the addresses 203.0.113.10 through 203.0.113.14 and 203.0.113.100/32
on interface ge-0/0/0.0. This allows the Juniper Networks security device to respond
to ARP requests received on the interface for those addresses.
• Security policy to permit traffic from the trust zone to the untrust zone.
• Security policy to permit traffic from the untrust zone to the translated destination IP
addresses in the trust zone.
Configuration
CLI Quick To quickly configure this example, copy the following commands, paste them into a text
Configuration file, remove any line breaks, change any details necessary to match your network
configuration, copy and paste the commands into the CLI at the [edit] hierarchy level,
and then enter commit from configuration mode.
Step-by-Step The following example requires you to navigate throughout various levels in the
Procedure configuration hierarchy. For instructions on how to do that, see Using the CLI Editor in
Configuration Mode.
3. Configure a rule that matches packets and translates the source address to an
address in the source NAT pool.
6. Configure a rule that matches packets and translates the destination address to
the address in the destination NAT pool.
8. Configure a security policy that allows traffic from the trust zone to the untrust zone.
10. Configure a security policy that allows traffic from the untrust zone to the trust zone.
Results From configuration mode, confirm your configuration by entering the show security nat
and show security policies commands. If the output does not display the intended
configuration, repeat the configuration instructions in this example to correct it.
[edit]
user@host# show security nat
source {
pool src-nat-pool-1 {
address {
203.0.113.10/32 to 203.0.113.14/32;
}
}
rule-set rs1 {
to zone untrust;
rule r1 {
match {
source-address 0.0.0.0/0;
destination-address 0.0.0.0/0;
}
then {
source-nat {
pool {
src-nat-pool-1;
}
}
}
}
}
}
destination {
pool dst-nat-pool-1 {
address 10.1.1.200/32;
}
rule-set rs1 {
from zone untrust;
rule r1 {
match {
destination-address 203.0.113.100/32;
}
then {
destination-nat pool dst-nat-pool-1;
}
}
}
}
proxy-arp {
interface ge-0/0/0.0 {
address {
203.0.113.10/32 to 203.0.113.14/32;
203.0.113.100/32;
}
}
}
user@host# show security policies
from-zone trust to-zone untrust {
policy internet-access {
match {
source-address any;
destination-address any;
application any;
}
}
policy internet-access {
then {
permit;
}
}
}
from-zone untrust to-zone trust {
policy dst-nat-pool-1-access {
match {
source-address any;
destination-address dst-nat-pool-1;
application any;
}
then {
permit;
}
}
}
If you are done configuring the device, enter commit from configuration mode.
Verification
Purpose Verify that there is traffic using IP addresses from the source NAT pool.
Action From operational mode, enter the show security nat source pool all command. View the
Translation hits field to check for traffic using IP addresses from the pool.
Purpose Verify that there is traffic matching the source NAT rule.
Action From operational mode, enter the show security nat source rule all command. View the
Translation hits field to check for traffic that matches the rule.
Purpose Verify that there is traffic using IP addresses from the destination NAT pool.
Action From operational mode, enter the show security nat destination pool all command. View
the Translation hits field to check for traffic using IP addresses from the pool.
Purpose Verify that there is traffic matching the destination NAT rule.
Action From operational mode, enter the show security nat destination rule all command. View
the Translation hits field to check for traffic that matches the rule.
Action From operational mode, enter the show security flow session command.
For all ALG traffic, except FTP, we recommend that you not use the source-port rule
option. Data session creation can fail if this option is used because the IP address and
the source port value, which is a random value, might not match the rule.
In addition, we recommend that you not use the destination-port option or the application
option as matching conditions for ALG traffic. If these options are used, translation may
fail because the port value in the application payload might not match the port value in
the IP address.
If multiple source NAT rules overlap in the match conditions, the most specific rule is
chosen. For example, if rules A and B specify the same source and destination IP
addresses, but rule A specifies traffic from zone 1 to zone 2 and rule B specifies traffic
from zone 1 to interface ge-0/0/0, rule B is used to perform source NAT. An interface
match is considered to be more specific than a zone match, which is more specific than
a routing instance match.
The actions you can specify for a source NAT rule are:
Source NAT rules are applied to traffic in the first packet that is processed for the flow
or in the fast path for the ALG. Source NAT rules are processed after static NAT rules,
destination NAT rules, and reverse mapping of static NAT rules and after route and
security policy lookup.
When zones are not configured under rule-set and when active source NAT is configured
with missing mandatory statement “from” then, the following message is displayed when
performing commit “Missing mandatory statement: 'from' error: configuration check-out
failed” and the configuration check-out fails.
• Requirements on page 68
• Overview on page 68
• Configuration on page 71
• Verification on page 74
Requirements
• Configure network interfaces on the device. See Interfaces Feature Guide for Security
Devices.
• Create security zones and assign interfaces to them. See Understanding Security Zones.
Overview
This example uses the trust security zone for the private address space and the untrust
security zone for the public address space. In Figure 5 on page 69, the following
translations are performed on the Juniper Networks security device for the source NAT
mapping for traffic from the trust zone to the untrust zones:
• The source IP address in packets sent by the 10.1.1.0/24 and 10.1.2.0/24 subnets to any
address in the untrust zone is translated to a public address in the range from 192.0.2.1
to 192.0.2.24 with port translation.
• The source IP address in packets sent by the 192.168.1.0/24 subnet to any address in
the untrust zone is translated to a public address in the range from 192.0.2.100 to
192.0.2.249 with no port translation.
• The source IP address in packets sent by the 192.168.1.250/32 host device is not
translated.
Untrust
zone Internet
Public address
space
ge-0/0/0
SRX Series device 192.0.2.0/24
192.168.1.250/32
10.1.1.0/24 192.168.1.0/24
Trust
zone
10.1.2.0/24
Private address
space
g030673
• Source NAT pool src-nat-pool-1 that contains the IP address range 192.0.2.1 through
192.0.2.24.
• Source NAT pool src-nat-pool-2 that contains the IP address range 192.0.2.100 through
192.0.2.249, with port address translation disabled.
• Source NAT rule set rs1 to match packets from the trust zone to the untrust zone. Rule
set rs1 contains multiple rules:
• Rule r1 to match packets with a source IP address in either the 10.1.1.0/24 or 10.1.2.0/24
subnets. For matching packets, the source address is translated to an IP address in
the src-nat-pool-1 pool.
• Rule r3 to match packets with a source IP address in the 192.168.1.0/24 subnet. For
matching packets, the source address is translated to an IP address in the
src-nat-pool-2 pool.
NOTE: The order of rules in a rule set is important, as the first rule in the
rule set that matches the traffic is used. Therefore, rule r2 to match a
specific IP address must be placed before rule r3 that matches the subnet
on which the device is located.
• Proxy ARP for the addresses 192.0.2.1 through 192.0.2.24 and 192.0.2.100 through
192.0.2.249 on interface ge-0/0/0.0. This allows the Juniper Networks security device
to respond to ARP requests received on the interface for those addresses.
• Security policies to permit traffic from the trust zone to the untrust zone.
On SRX4600 devices, when you configure source NAT rule or pool with rule name or
pool name as interface or service-set you will receive the following error message: syntax
error, expecting <data>.
• If there is a source NAT rule named interface, the rule cannot be viewed using the show
security nat source rule interface command.
• If there is a source NAT rule named service-set, the rule cannot be viewed using the
show security nat source rule service-set command.
• If there is a source NAT pool named interface, the pool cannot be viewed using the
show security nat source pool interface command.
• If there is a source NAT pool named service-set, the pool cannot be viewed using the
show security nat source pool service-set command.
• If there is a source NAT pool named interface, the paired-address cannot be viewed
using the show security nat source paired-address pool-name interface command.
• If there is a source NAT pool named service-set, the paired-address cannot be viewed
using the show security nat source paired-address pool-name service-set command.
Configuration
CLI Quick To quickly configure this example, copy the following commands, paste them into a text
Configuration file, remove any line breaks, change any details necessary to match your network
configuration, copy and paste the commands into the CLI at the [edit] hierarchy level,
and then enter commit from configuration mode.
Step-by-Step The following example requires you to navigate throughout various levels in the
Procedure configuration hierarchy. For instructions on how to do that, see Using the CLI Editor in
Configuration Mode.
4. Configure a rule that matches packets and translates the source address to an
address in the pool.
5. Configure a rule to match packets for which the source address is not translated.
6. Configure a rule to match packets and translate the source address to an address
in the pool with no port translation.
8. Configure a security policy that allows traffic from the trust zone to the untrust zone.
Results From configuration mode, confirm your configuration by entering the show security nat
and show security policies commands. If the output does not display the intended
configuration, repeat the configuration instructions in this example to correct it.
[edit]
user@host# show security nat
source {
pool src-nat-pool-1 {
address {
192.0.2.1/32 to 192.0.2.24/32;
}
}
pool src-nat-pool-2 {
address {
192.0.2.100/32 to 192.0.2.249/32;
}
port no-translation;
}
rule-set rs1 {
from zone trust;
to zone untrust;
rule r1 {
match {
source-address [ 10.1.1.0/24 10.1.2.0/24 ];
destination-address 0.0.0.0/0;
}
then {
source-nat {
pool {
src-nat-pool-1;
}
}
}
}
rule r2 {
match {
source-address 192.168.1.250/32;
destination-address 0.0.0.0/0;
}
then {
source-nat {
off;
}
}
}
rule r3 {
match {
source-address 192.168.1.0/24;
destination-address 0.0.0.0/0;
}
then {
source-nat {
pool {
src-nat-pool-2;
}
}
}
}
}
}
proxy-arp {
interface ge-0/0/0.0 {
address {
192.0.2.1/32 to 192.0.2.24/32;
192.0.2.100/32 to 192.0.2.249/32;
}
}
}
user@host# show security policies
from-zone trust to-zone untrust {
policy internet-access {
match {
source-address any;
destination-address any;
application any;
}
then {
permit;
}
}
}
If you are done configuring the device, enter commit from configuration mode.
Verification
Purpose Verify that there is traffic using IP addresses from the source NAT pool.
Action From operational mode, enter the show security nat source pool all command. View the
Translation hits field to check for traffic using IP addresses from the pool.
Purpose Verify that there is traffic matching the source NAT rule.
Action From operational mode, enter the show security nat source rule all command. View the
Translation hits field to check for traffic that matches the rule.
Action From operational mode, enter the show security flow session command.
For source Network Address Translation (NAT) address pools, specify the following:
NOTE: Do not overlap NAT addresses for source NAT, destination NAT,
and static NAT within one routing instance.
• Routing instance—Routing instance to which the pool belongs (the default is the main
inet.0 routing instance).
• Port —The Port Address Translation (PAT) for a source pool. By default, PAT is
performed with source NAT. If you specify the no-translation option, the number of
hosts that the source NAT pool can support is limited to the number of addresses in
the pool. If you specify block-allocation, a block of ports is allocated for translation,
instead of individual ports being allocated. If you specify deterministic, an incoming
(source) IP address and port always map to the specific destination address and port
block, based on predefined, deterministic NAT algorithm. If you specify port-overloading,
you can configure the port overloading capacity in source NAT. If you specify range,
you can provide the port number range attached to each address in the pool, and the
twin port range for source NAT pools.
• Pool utilization alarm (optional)— When the raise-threshold option is configured for
source NAT, an SNMP trap is triggered if the source NAT pool utilization rises above
this threshold. If the optional clear-threshold option is configured, an SNMP trap is
triggered if the source NAT pool utilization drops below this threshold. If clear-threshold
is not configured, it is set by default to 80 percent of the raise-threshold value.
You can use the show security nat resource usage source pool command to view address
use in a source NAT pool without PAT, and to view port use in a source NAT pool with
PAT.
Maximum capacities for source pools and IP addresses on SRX1400, SRX1500, SRX3400,
SRX3600, SRX4100, SRX4200, SRX5400, SRX5600, and SRX5800 devices are as
follows:
Pool/PAT SRX5400
Maximum Address SRX1400 SRX3400 SRX4100 SRX5600
Capacity SRX1500 SRX3600 SRX4200 SRX5800
Increasing the total number of IP addresses used for source NAT, either by increasing the
number of pools in the configuration and/or by increasing the capacity or IP-addresses
per pool, consumes memory needed for port allocation. When source NAT pool and IP
address limits are reached, port ranges should be reassigned. That is, the number of ports
for each IP address should be decreased when the number of IP addresses and source
NAT pools is increased. This ensures NAT does not consume too much memory.
For example, in a source NAT pool for SRX5000 devices, when the number of IP addresses
supporting port translation reaches the limit of 1M, the total number of PAT ports is 64G,
which exceeds the 384M limitation. This is because, by default, each IP address supports
64,512 ports. To ensure that PAT port numbers are within capacity, the port range for
each IP needs to be configured to decrease the total number of PAT ports.
Use the range and range twin-port options at the [edit security nat source pool port]
hierarchy level to assign a new port range or twin port range for a specific pool. Use the
pool-default-port-range and the pool-default-twin-port-range options at the [edit security
nat source] hierarchy level to specify the global default port range or twin port range for
all source NAT pools.
Configuring port overloading should also be done carefully when source NAT pools are
increased.
For a source pool with PAT in range (63,488 through 65,535), two ports are allocated
at one time for RTP/RTCP applications, such as SIP, H.323, and RTSP. In these scenarios,
each IP address supports PAT, occupying 2048 ports (63,488 through 65,535) for ALG
module use.
This option differs from the address-pooling paired option, where the internal address
is mapped to an external address within the pool on a first-come, first-served basis, and
might be mapped to a different external address for each session.
• Requirements on page 78
• Overview on page 79
• Configuration on page 79
• Verification on page 80
Requirements
1. Configure network interfaces on the device. See Interfaces Feature Guide for Security
Devices.
2. Create security zones and assign interfaces to them. See Understanding Security Zones.
Overview
This example shows how to configure a PAT pool of 2048 IP addresses with 32,000
ports for each IP address.
Configuration
CLI Quick To quickly configure this example, copy the following commands, paste them into a text
Configuration file, remove any line breaks, change any details necessary to match your network
configuration, copy and paste the commands into the CLI at the [edit] hierarchy level,
and then enter commit from configuration mode.
Step-by-Step The following example requires you to navigate throughout various levels in the
Procedure configuration hierarchy. For instructions on how to do that, see Using the CLI Editor in
Configuration Mode.
Results From configuration mode, confirm your configuration by entering the show security
nat-source-summary command. If the output does not display the intended configuration,
repeat the configuration instructions in this example to correct it.
Pool Address Routing PAT Total Name Range Instance Address pool2 203.0.113.1 -
203.0.113.3 default yes 2048
Total rules: 1
Rule name Rule set From To Action
rule 1 ruleset1 ge-2/2/2.0 ge-2/2/3.0 pool1
rule 1 ge-2/2/4.0 ge-2/2/5.0
If you are done configuring the device, enter commit from configuration mode.
Verification
Purpose View port and pool information. Port limitations are automatically checked, so the
configuration will not be committed if port limitations are exceeded.
Action From operational mode, enter the show security nat source summary command to view
port and pool details.
Because some applications require the same source IP address for each session, you can
use the address-pooling paired feature to enable all sessions associated with one internal
IP address to map to the same external IP address for the duration of the sessions. When
the sessions end, the mapping between the internal IP address and the external IP address
ceases. The next time the host initiates a session, a different IP address from the pool
might be assigned to it.
This differs from the source NAT address-persistent feature, which keeps the mapping
static; the same internal IP address is mapped to the same external IP address every
time. It also differs from the address-persistent feature in that address-pooling paired is
configured for a specific pool. The address-persistent feature is a global configuration
that applies to all source pools.
The range of original source IP addresses that are translated is determined by the number
of addresses in the source NAT pool. For example, if the source NAT pool contains a
range of ten IP addresses, then up to ten original source IP addresses can be translated,
starting with a specified base address. This type of translation is one-to-one, static, and
without port address translation.
The match condition in a source NAT rule may define a larger address range than that
specified in the source NAT pool. For example, a match condition might specify an address
prefix that contains 256 addresses, but the source NAT pool might contain a range of
only a few IP addresses, or only one IP address. A packet’s source IP address can match
a source NAT rule, but if the source IP address is not within the address range specified
in the source NAT pool, the source IP address is not translated.
NOTE: The match conditions for a source NAT rule set do not allow you to
specify an address range; only address prefixes may be specified in a rule.
When configuring a source NAT pool, you can specify the host-base-address
option; this option specifies the IP address where the original source IP
address range begins, and disables port translation.
The match condition in a source NAT rule may define a larger address range
than that specified in the source NAT pool. For example, a match condition
might specify an address prefix that contains 256 addresses, but the source
NAT pool contains a range of only ten IP addresses. A packet’s source IP
address can match a source NAT rule, but if the source IP address is not within
the address range specified in the source NAT pool, the source IP address is
not translated.
• Requirements on page 81
• Overview on page 82
• Configuration on page 83
• Verification on page 85
Requirements
• Configure network interfaces on the device. See Interfaces Feature Guide for Security
Devices.
• Create security zones and assign interfaces to them. See Understanding Security Zones.
Overview
This example uses the trust security zone for the private address space and the untrust
security zone for the public address space. In Figure 6 on page 82, a range of private
addresses in the trust zone is mapped to a range of public addresses in the untrust zone.
For packets sent from the trust zone to the untrust zone, a source IP address in the range
of 192.168.1.10/32 through 192.168.1.20/32 is translated to a public address in the range
of 203.0.113.30/32 through 203.0.113.40/32.
Untrust
zone Internet
Public address
space
ge-0/0/0
SRX Series device 203.0.113.0/24
ge-1/0/0
192.168.1.0/24
Trust
zone
Private address
space
g030672
• Source NAT pool src-nat-pool-1 that contains the IP address range 203.0.113.30/32
through 203.0.113.40/32. For this pool, the beginning of the original source IP address
range is 192.168.1.10/32 and is specified with the host-address-base option.
• Source NAT rule set rs1 with rule r1 to match packets from the trust zone to the untrust
zone with a source IP address in the 192.168.1.0/24 subnet. For matching packets that
fall within the source IP address range specified by the src-nat-pool-1 configuration,
the source address is translated to the IP address in src-nat-pool-1 pool.
• Security policies to permit traffic from the trust zone to the untrust zone.
Configuration
CLI Quick To quickly configure this example, copy the following commands, paste them into a text
Configuration file, remove any line breaks, change any details necessary to match your network
configuration, copy and paste the commands into the CLI at the [edit] hierarchy level,
and then enter commit from configuration mode.
Step-by-Step The following example requires you to navigate throughout various levels in the
Procedure configuration hierarchy. For instructions on how to do that, see Using the CLI Editor in
Configuration Mode.
4. Configure a rule that matches packets and translates the source address to an
address in the pool.
6. Configure a security policy that allows traffic from the trust zone to the untrust zone.
Results From configuration mode, confirm your configuration by entering the show security nat
and show security policies commands. If the output does not display the intended
configuration, repeat the configuration instructions in this example to correct it.
[edit]
user@host# show security nat
source {
pool src-nat-pool-1 {
address {
203.0.113.30/32 to 203.0.113.40/32;
}
host-address-base 192.168.1.10/32;
}
rule-set rs1 {
from zone trust;
to zone untrust;
rule r1 {
match {
source-address 192.168.1.0/24;
}
then {
source-nat {
pool {
src-nat-pool-1;
}
}
}
}
}
}
proxy-arp {
interface ge-0/0/0.0 {
address {
203.0.113.30/32 to 203.0.113.40/32;
}
}
}
user@host# show security policies
from-zone trust to-zone untrust {
policy internet-access {
match {
source-address any;
destination-address any;
application any;
}
then {
permit;
}
}
}
If you are done configuring the device, enter commit from configuration mode.
Verification
Purpose Verify that there is traffic using IP addresses from the source NAT pool.
Action From operational mode, enter the show security nat source pool all command. View the
Translation hits field to check for traffic using IP addresses from the pool.
Purpose Verify that there is traffic matching the source NAT rule.
Action From operational mode, enter the show security nat source rule all command. View the
Translation hits field to check for traffic that matches the rule.
Action From operational mode, enter the show security flow session command.
Junos OS maintains a list of assigned port numbers to distinguish what session belongs
to which host. When PAT is enabled, up to 63,488 hosts can share a single IP address.
Each source pool can contain multiple IP addresses, multiple IP address ranges, or both.
For a source pool with PAT, Junos OS may assign different addresses to a single host for
different concurrent sessions, unless the source pool or Junos OS has the persistent
address feature or the paired address pooling feature enabled.
For interface source pool and source pool with PAT, range (1024, 65535) is available for
port number mapping per IP address. Within range (1024, 63487) one port is allocated
at a time, for a total of 62,464 ports. In range (63488, 65535), two ports are allocated
at a time for RTP/RTCP applications such as SIP, H.323, and RTSP, for a total of 2,048
ports.
When a host initiates several sessions that match a policy that requires network address
translation and is assigned an address from a source pool that has PAT enabled, the
device assigns a different source IP address for each session. Such random address
assignment can be problematic for services that create multiple sessions that require
the same source IP address for each session. For example, it is important to have the
same IP address for multiple sessions when using the AOL Instant Message (AIM) client.
To ensure that the router assigns the same IP address from a source pool to a host for
multiple concurrent sessions, you can enable a persistent IP address per router. To ensure
that the device assigns the same IP address from a source pool to a host for the duration
of a single session, you can enable paired address pooling.
• Requirements on page 87
• Overview on page 87
• Configuration on page 89
• Verification on page 91
Requirements
1. Configure network interfaces on the device. See Interfaces Feature Guide for Security
Devices.
2. Create security zones and assign interfaces to them. See Understanding Security Zones.
Overview
This example uses the trust security zone for the private address space and the untrust
security zone for the public address space. In Figure 7 on page 88, the source IP address
in packets sent from the trust zone to the untrust zone is mapped to a smaller block of
public addresses in the range from 203.0.113.1/32 through 203.0.113.24/32. Because the
size of the source NAT address pool is smaller than the number of potential addresses
that might need to be translated, port address translation is used.
NOTE: Port address translation includes a source port number with the source
IP address mapping. This allows multiple addresses on a private network to
map to a smaller number of public IP addresses. Port address translation is
enabled by default for source NAT pools.
Untrust
zone Internet
Public address
space
ge-0/0/0
SRX Series device 203.0.113.0/24
10.1.1.0/24 192.168.2.0/24
Trust
zone
10.1.2.0/24
Private address
space
g030670
• Source NAT pool src-nat-pool-1 that contains the IP address range 203.0.113.1/32
through 203.0.113.24/32.
• Source NAT rule set rs1 to match all packets from the trust zone to the untrust zone.
For matching packets, the source IP address is translated to an IP address in the
src-nat-pool-1 pool.
• Security policies to permit traffic from the trust zone to the untrust zone.
Configuration
CLI Quick To quickly configure this example, copy the following commands, paste them into a text
Configuration file, remove any line breaks, change any details necessary to match your network
configuration, copy and paste the commands into the CLI at the [edit] hierarchy level,
and then enter commit from configuration mode.
Step-by-Step The following example requires you to navigate throughout various levels in the
Procedure configuration hierarchy. For instructions on how to do that, see Using the CLI Editor in
Configuration Mode.
To configure a source NAT mapping from a private address block to a smaller public
address block using PAT:
3. Configure a rule that matches packets and translates the source address to an
address in the pool.
5. Configure a security policy that allows traffic from the trust zone to the untrust zone.
Results From configuration mode, confirm your configuration by entering the show security nat
and show security policies commands. If the output does not display the intended
configuration, repeat the configuration instructions in this example to correct it.
[edit]
user@host# show security nat
source {
pool src-nat-pool-1 {
address {
203.0.113.1/32 to 203.0.113.24/32;
}
}
rule-set rs1 {
from zone trust;
to zone untrust;
rule r1 {
match {
source-address [10.1.1.0/24 10.1.2.0/24 192.168.1.0/24];
destination-address 0.0.0.0/0;
}
then {
source-nat {
pool {
src-nat-pool-1;
}
}
}
}
}
}
proxy-arp {
interface ge-0/0/0.0 {
address {
203.0.113.1/32 to 203.0.113.24/32;
}
}
}
user@host# show security policies
from-zone trust to-zone untrust {
policy internet-access {
match {
source-address any;
destination-address any;
application any;
}
then {
permit;
}
}
}
If you are done configuring the device, enter commit from configuration mode.
Verification
Purpose Verify that there is traffic using IP addresses from the source NAT pool.
Action From operational mode, enter the show security nat source pool all command. View the
Translation hits field to check for traffic using IP addresses from the pool.
Purpose Verify that there is traffic matching the source NAT rule.
Action From operational mode, enter the show security nat source rule all command. View the
Translation hits field to check for traffic that matches the rule.
Action From operational mode, enter the show security flow session command.
When using a source pool without PAT, Junos OS performs source Network Address
Translation for the IP address without performing PAT for the source port number. For
applications that require that a particular source port number remain fixed, you must use
source pool without PAT.
The source pool can contain multiple IP addresses, multiple IP address ranges, or both.
For source pool without PAT, Junos OS assigns one translated source address to the
same host for all its concurrent sessions unless the address-pooling no-paired option is
enabled.
The number of hosts that a source NAT pool without PAT can support is limited to the
number of addresses in the pool. When you have a pool with a single IP address, only
one host can be supported, and traffic from other hosts is blocked because there are no
resources available. If a single IP address is configured for a source NAT pool without
PAT when NAT resource assignment is not in active-backup mode in a chassis cluster,
traffic through node 1 will be blocked.
Pool utilization for each source pool without PAT is computed. You can turn on pool
utilization alarm by configuring alarm thresholds. An SNMP trap is triggered every time
pool utilization rises above a threshold and goes below a threshold.
NOTE: If a static NAT rule is for one-to-one IP translation, avoid dividing the
rule into a destination rule and a source rule when source no-pat pool without
address sharing is used. If you choose to divide the rule, you will then have
to use source pat-pool with single IP or source no-pat pool with multiple IP.
NOTE: PAT is enabled by default for source NAT pools. When PAT is disabled,
the number of translations that the source NAT pool can concurrently support
is limited to the number of addresses in the pool. Packets are dropped if there
are no addresses available in the source NAT pool. However, using the
address-shared option, you can map more that one private IP address to a
single public IP address as long as the traffic is from different source ports.
• Requirements on page 93
• Overview on page 93
• Configuration on page 93
• Verification on page 95
Requirements
1. Configure network interfaces on the device. See Interfaces Feature Guide for Security
Devices.
2. Create security zones and assign interfaces to them. See Understanding Security Zones.
Overview
This example uses the trust security zone for the private address space and the untrust
security zone for the public address space. The source IP address of packets sent from
the trust zone to the untrust zone are mapped to a single public address.
• Source NAT pool src-nat-pool-1 that contains the IP address 203.0.113.1/30. The port
no-translation option and the address shared option are specified for the pool.
• Source NAT rule set rs1 to match all packets from the trust zone to the untrust zone.
For matching packets, the source IP address is translated to an IP address in the
src-nat-pool-1 pool.
• Security policies to permit traffic from the trust zone to the untrust zone.
Configuration
CLI Quick To quickly configure this example, copy the following commands, paste them into a text
Configuration file, remove any line breaks, change any details necessary to match your network
configuration, copy and paste the commands into the CLI at the [edit] hierarchy level,
and then enter commit from configuration mode.
Step-by-Step The following example requires you to navigate throughout various levels in the
Procedure configuration hierarchy. For instructions on how to do that, see Using the CLI Editor in
Configuration Mode.
To configure a source NAT mapping from a private address block to a single public address
without PAT:
1. Create a source NAT pool with a single IP address for the shared address.
4. Configure a rule that matches packets and translates the source address to an
address in the pool.
5. Configure a security policy that allows traffic from the trust zone to the untrust zone.
Results From configuration mode, confirm your configuration by entering the show security nat
source pool and show security policies commands. If the output does not display the
intended configuration, repeat the configuration instructions in this example to correct
it.
[edit]
user@host# show security nat
source {
pool src-nat-pool-1 {
address {
203.0.113.1/30
}
port no-translation;
}
address-shared;
rule-set rs1 {
from zone trust;
to zone untrust;
rule r1 {
match {
source-address [192.0.2.0/24]
}
then {
source-nat {
pool {
src-nat-pool-1;
}
}
}
}
}
}
user@host# show security policies
from-zone trust to-zone untrust {
policy internet-access {
match {
source-address any;
destination-address any;
application any;
}
then {
permit;
}
}
}
If you are done configuring the device, enter commit from configuration mode.
Verification
Purpose Verify that two internal IP addresses, with different source ports, share one external IP
address.
Action From operational mode, enter the show security nat source pool command. View the
Address assignment field to verify that it is shared.
Purpose Verify that two sessions are using the same IP address.
Action From operational mode, enter the show security flow session command.
NOTE: Port address translation is enabled by default for source NAT pools.
When port address translation is disabled, the number of translations that
the source NAT pool can concurrently support is limited to the number of
addresses in the pool. Packets are dropped if there are no addresses available
in the source NAT pool. You can optionally specify an overflow pool from
which IP addresses and port numbers are allocated when there are no
addresses available in the original source NAT pool.
• Requirements on page 96
• Overview on page 96
• Configuration on page 98
• Verification on page 100
Requirements
1. Configure network interfaces on the device. See Interfaces Feature Guide for Security
Devices.
2. Create security zones and assign interfaces to them. See Understanding Security Zones.
Overview
This example uses the trust security zone for the private address space and the untrust
security zone for the public address space. In Figure 8 on page 97, the source IP address
in packets sent from the trust zone to the untrust zone is mapped to a smaller block of
public addresses in the range from 203.0.113.1/32 through 203.0.113.24/32.
Untrust
zone Internet
Public address
space
ge-0/0/0
SRX Series device 203.0.113.0/24
10.1.1.0/24 192.168.1.0/24
Trust
zone
10.1.2.0/24
Private address
space
g030671
• Source NAT pool src-nat-pool-1 that contains the IP address range 203.0.113.1/32
through 203.0.113.24/32. The port no-translation option is specified for the pool.
• Source NAT rule set rs1 to match all packets from the trust zone to the untrust zone.
For matching packets, the source IP address is translated to an IP address in the
src-nat-pool-1 pool.
• Security policies to permit traffic from the trust zone to the untrust zone.
Configuration
CLI Quick To quickly configure this example, copy the following commands, paste them into a text
Configuration file, remove any line breaks, change any details necessary to match your network
configuration, copy and paste the commands into the CLI at the [edit] hierarchy level,
and then enter commit from configuration mode.
Step-by-Step The following example requires you to navigate throughout various levels in the
Procedure configuration hierarchy. For instructions on how to do that, see Using the CLI Editor in
Configuration Mode.
To configure a source NAT mapping from a private address block to a smaller public
address block without PAT:
4. Configure a rule that matches packets and translates the source address to an
address in the pool.
6. Configure a security policy that allows traffic from the trust zone to the untrust zone.
Results From configuration mode, confirm your configuration by entering the show security nat
and show security policies commands. If the output does not display the intended
configuration, repeat the configuration instructions in this example to correct it.
[edit]
user@host# show security nat
source {
pool src-nat-pool-1 {
address {
203.0.113.1/32 to 203.0.113.24/32;
}
port no-translation;
}
rule-set rs1 {
from zone trust;
to zone untrust;
rule r1 {
match {
source-address 0.0.0.0/0;
destination-address 0.0.0.0/0;
}
then {
source-nat {
pool {
src-nat-pool-1;
}
}
}
}
}
}
proxy-arp {
interface ge-0/0/0.0 {
address {
203.0.113.1/32 to 203.0.113.24/32;
}
}
}
user@host# show security policies
from-zone trust to-zone untrust {
policy internet-access {
match {
source-address any;
destination-address any;
application any;
}
then {
permit;
}
}
}
If you are done configuring the device, enter commit from configuration mode.
Verification
Purpose Verify that there is traffic using IP addresses from the source NAT pool.
Action From operational mode, enter the show security nat source pool all command. View the
Translation hits field to check for traffic using IP addresses from the pool.
Purpose Verify that there is traffic matching the source NAT rule.
Action From operational mode, enter the show security nat source rule all command. View the
Translation hits field to check for traffic that matches the rule.
Action From operational mode, enter the show security flow session command.
For example, if there is a source NAT pool with no port translation containing only two
IP addresses, IP 1 and IP 2, when a packet arrives from
However, if another packet arrives from Source IP 3, port 1 for a different destination
IP and port, it cannot be translated to IP 1, port 1 or IP 2, port 1 because port 1 is already
used for both available IP addresses. The session will fail.
This option increases NAT resources and improves the possibility of setting up successful
translated traffic. It cannot be used on source NAT pools with port address translation
because address sharing is already their default behavior.
From Junos OS Release 18.3R1 onward, with the support for NAT session persistence,
the Packet Forwarding Engine scans the sessions and decides whether to keep the
sessions or clear the sessions. In releases before Junos OS Release 18.3R1, the NAT
sessions are cleared if there is a change in the NAT configuration.
The Packet Forwarding Engine performs the following two types of scans to decide
whether to retain or drop sessions:
• Source NAT pool session persistence scan—The Packet Forwarding Engine compares
the existing session IP address with source pool address range. If the existing session
IP address is in the specified source pool address range, the session is kept alive,
otherwise the session is cleared.
• Source NAT rule session persistence scan—The Packet Forwarding Engine uses the
rule ID to compare the source IP address, source port, destination IP address, and
destination port between the old and new configurations. If the new and old
configurations are the same, then the session is kept alive, otherwise the session is
cleared.
NOTE:
• NAT session persistence is not supported for static NAT and destination
NAT.
• NAT session persistence is not supported if the PAT pool is configured with
the address persistent, address pooling paired, source address-persistent,
port block allocation, port deterministic, persistent nat, and port overloading
factor fields.
NAT session persistence is supported only for source NAT in the following scenarios:
• Source rule—Change in match conditions for the address book, application, destination
IP address, destination port, source IP address, and destination port information.
You can also configure a timeout value to retain the sessions for the specified time period
by using the set security nat source session-drop-hold-down CLI command. The value of
the session-drop-hold-down option ranges from 30 through 28,800 seconds (eight hours).
The session expires after the configured timeout period.
• When there is a change in IP addresses in the NAT source pool, the newly configured
IP addresses are appended to the NAT source pool. After the NAT source pool is rebuilt,
the new IP addresses are not the same as the existing IP addresses. The differences
in the IP addresses in the NAT source pool impacts the round-robin mode of picking
IP addresses from the NAT source pool.
• If the scan types identify sessions that will never be timed out (that is, the sessions for
which the session-drop-hold-down value is not configured or is configured as 8 hours),
then the Packet Forwarding Engine ignores those sessions, and the sessions are retained.
Configuring the NAT Session Hold Timeout and NAT Session Persistence Scan
This configuration shows how to configure the NAT session hold timeout and NAT session
persistence.
The following configuration shows how to configure the NAT session hold timeout.
The value of the time variable ranges from 30 through 28,800 seconds (eight hours).
The session expires after the configured timeout period.
Results
From configuration mode, confirm your configuration by entering the show security
command. If the output does not display the intended configuration, repeat the
configuration instructions in this example to correct it.
[edit]
user@host# show security
nat {
source {
session-drop-hold-down 28800;
}
}
The following configuration shows how to configure the NAT session persistence scan.
Results
From configuration mode, confirm your configuration by entering the show security
command. If the output does not display the intended configuration, repeat the
configuration instructions in this example to correct it.
[edit]
user@host# show security
nat {
source {
session-persistence-scan;
}
}
• The session is retained with the existing NAT rule, if the new egress interface and the
previous egress interface are in the same security zone, and there is no change in the
matched NAT rule or if no rule is applied before and after rerouting.
• The session expires if the new egress interface and the previous egress interface are
in the same security zone and the matched NAT rule is changed.
• The traffic is forwarded to the new egress interface if the new egress interface and the
previous egress interface are in the same security zone.
Configuration
To enable the NAT configuration for an existing session when there is a change in egress
interface because of rerouting, use the following command:
[edit]
user@host# set security flow enable-reroute-uniform-link-check nat
The new configuration is applied when you commit the configuration changes.
Limitations
• The TCP synchronization does not allow the new session to transfer the traffic. You
must disable the TCP synchronization to allow the transfer of traffic in new sessions.
• The packet information might lost if reroute is initiated after a three-way handshake
to initialize communication. You must disable the Junos OS Services Framework (JSF)
like Application Layer Gateway (ALG) to allow the transfer of traffic in new sessions.
17.4R1 Starting in Junos OS Release 17.4R1, source NAT resources handled by the
central point architecture have been offloaded to the SPUs when the SPC
number is more than four, resulting in more efficient resource allocation.
15.1X49-D30 Starting in Junos OS Release 15.1X49-D30 and Junos OS Release 17.3R1, the
central point architecture for NAT has been enhanced to handle higher system
session capacity and session ramp-up rate for the SRX5000 line.
12.3X48-D40 In Release 12.3X48-D40, and in Release 15.1X49-D60 and later releases, you
can increase the source NAT port capacity to 2.4G on SRX5400, SRX5600,
and SRX5800 devices with next-generation Services Processing Cards (SPCs)
using the port-scaling-enlargement statement at the [edit security nat
source] hierarchy level supported
Destination NAT
Destination NAT changes the destination address of packets passing through the Router.
It also offers the option to perform the port translation in the TCP/UDP headers.
Destination NAT mainly used to redirect incoming packets with an external address or
port destination to an internal IP address or port inside the network.
• Example: Configuring Destination NAT for Single Address Translation on page 108
• Example: Configuring Destination NAT for IP Address and Port Translation on page 115
• Example: Configuring Destination NAT for Subnet Translation on page 121
• Monitoring Destination NAT Information on page 127
• Translate a destination IP address and port to another destination IP address and port
(for example, to allow access to multiple services using the same IP address but
different ports).
• Translation of the original destination IP address (and optional port number) to one
specific IP address (and port number) from a user-defined pool.
NOTE: Do not overlap NAT addresses for source NAT, destination NAT,
and static NAT within one routing instance.
• Routing instance to which the pool belongs—A destination NAT pool that does not
specify a specific routing instance will default to the routing instance of the ingress
zone.
NOTE: You can configure a NAT pool to exist in the default routing instance.
Configuration option to specify that a NAT pool exists in the default
routing-instance is available. As a result, the NAT pool is reachable from
zones in the default routing instance, and from zones in other routing
instances.
For ALG traffic, we recommend that you not use the destination-port option or the
application option as matching conditions. If these options are used, translation may fail
because the port value in the application payload might not match the port value in the
IP address.
If multiple destination NAT rules overlap in the match conditions, the most specific rule
is chosen. For example, if rules A and B specify the same source and destination IP
addresses, but rule A specifies traffic from zone 1 and rule B specifies traffic from interface
ge-0/0/0, rule B is used to perform destination NAT. An interface match is considered
to be more specific than a zone match, which is more specific than a routing instance
match.
The actions you can specify for a destination NAT rule are:
Destination NAT rules are applied to traffic in the first packet that is processed for the
flow or in the fast path for the ALG. Destination NAT rules are processed after static NAT
rules but before source NAT rules.
1. Configure a destination NAT address pool that aligns with your network and security
requirements.
2. Configure destination NAT rules that align with your network and security requirements.
3. Configure NAT proxy ARP entries for IP addresses in the same subnet of the ingress
interface.
Requirements
• Server
• Configure network interfaces on the device. See the Interfaces Feature Guide for Security
Devices.
• Create security zones and assign interfaces to them. See Understanding Security Zones.
Overview
the public IP address. Destination NAT address pool and destination NAT rules
configurations are used to align your network and improve security requirements.
In this example, first you configure the trust security zone for the private address space
and then you configure the untrust security zone for the public address space. In
Figure 9 on page 109, devices in the untrust zone access a server in the trust zone by way
of public address 3.0.113.200/32. For packets that enter the Juniper Networks security
device from the untrust zone with the destination IP address 203.0.113.200/32, the
destination IP address is translated to the private address 192.168.1.200/32.
Topology
Untrust
zone Internet
Public address
space
ge-0/0/0
SRX Series device 203.0.113.0/24
ge-1/0/0
192.168.1.0/24
Trust
zone
Private address
space
Server
192.168.1.200
203.0.113.200/32 192.168.1.200/32
g030665
Parameter Description
• Destination NAT rule set rs1 with rule r1 to match packets received from the ge-0/0/0.0
interface with the destination IP address 203.0.113.200/32. For matching packets, the
destination address is translated to the address in the dst-nat-pool-1 pool.
• Proxy ARP for the address 203.0.113.200/32 on interface ge-0/0/0.0. This allows the
Juniper Networks security device to respond to ARP requests received on the interface
for that address.
• Security policies to permit traffic from the untrust zone to the translated destination
IP address in the trust zone.
Configuration
CLI Quick To quickly configure this example, copy the following commands, paste them into a text
Configuration file, remove any line breaks, change any details necessary to match your network
configuration, copy and paste the commands into the CLI at the [edit] hierarchy level,
and then enter commit from configuration mode.
set security policies from-zone untrust to-zone trust policy server-access then permit
Step-by-Step The following example requires you to navigate various levels in the configuration
Procedure hierarchy. For instructions on how to do that, see Using the CLI Editor in Configuration
Mode in the CLI User Guide.
3. Configure a rule that matches packets and translates the destination address to
the address in the pool.
6. Configure a security policy that allows traffic from the untrust zone to the server in
the trust zone.
Results From configuration mode, confirm your configuration by entering the show interfaces,
show security zones, and show bridge-domains command. If the output does not display
the intended configuration, repeat the instructions in this example to correct the
configuration.
[edit]
user@host# show security nat
destination {
pool dst-nat-pool-1 {
address 192.168.1.200/32;
}
rule-set rs1 {
from interface ge-0/0/0.0;
rule r1 {
match {
destination-address 203.0.113.200/32;
}
then {
destination-nat pool dst-nat-pool-1;
}
}
}
}
proxy-arp {
interface ge-0/0/0.0 {
address {
203.0.113.200/32;
}
}
}
[edit]
user@host# show security address-book
global {
address server-1 192.168.1.200/32;
}
user@host# show security policies
from-zone untrust to-zone trust {
policy server-access {
match {
source-address any;
destination-address server-1;
application any;
}
then {
permit;
}
}
If you are done configuring the device, enter commit from configuration mode.
Verification
Purpose Verify that there is traffic using IP addresses from the destination NAT pool.
Action From operational mode, enter the show security nat destination pool all command. View
the Translation hits field to check for traffic using IP addresses from the pool.
Meaning The show security nat destination pool all command displays the pool of translated
addresses. View the Translation hits field to check for traffic using IP addresses from the
pool.
Purpose Verify that there is traffic matching the destination NAT rule.
Action From operational mode, enter the show security nat destination rule all command.
Meaning The show security nat destination rule all command displays the destination NAT rule.
View the Translation hits field to check for traffic that matches the destination rule.
Purpose Verify the configuration of destination NAT for a single address translation.
Action From operational mode, enter the show security nat destination summary command.
Total pools: 1
Pool name Address Range Routing Port Total
Instance Address
dst-nat-pool-1 192.168.1.200 - 192.168.1.200 0 1
Total rules: 1
Rule name Rule set From Action
r1 rs1 ge-0/0/0.0 dst-nat-pool-1
Meaning The show security nat destination summary command displays information about
destination NAT configuration. You can verify the following information:
• Rule sets
• Rules
• Address range
• NAT pool
• Port details
Action From operational mode, enter the show security flow session command.
Bytes: 84
Meaning The show security flow session command displays active sessions on the device and each
session’s associated security policy. The output shows traffic entering the device using
the private source address 203.0.113.219/30 destined to a public host at 203.0.113.200.
The return traffic from this flow travels to the translated public address 203.0.113.219.
• Session ID—Number that identifies the session. Use this ID to get more information
about the session such as policy name or number of packets in and out.
• server-access—Policy name that permitted the traffic from the untrust zone to the
translated destination IP address in the trust zone.
• In—Incoming flow (source and destination IP addresses with their respective source
and destination port numbers, the session is ICMP, and the source interface for this
session is ge-0/0/0.0).
• Out—Reverse flow (source and destination IP addresses with their respective source
and destination port numbers, the session is ICMP, and the destination interface for
this session is ge-0/0/1.0).
Requirements
1. Configure network interfaces on the device. See Interfaces Feature Guide for Security
Devices.
2. Create security zones and assign interfaces to them. See Understanding Security Zones.
Overview
This example uses the trust security zone for the private address space and the untrust
security zone for the public address space. In Figure 10 on page 117, devices in the untrust
zone access servers in the trust zone by way of public address 203.0.113.200 on port 80
or 8000. Packets entering the Juniper Networks security device from the untrust zone
are mapped to the private addresses of the servers as follows:
• The destination IP address 203.0.113.200 and port 8000 is translated to the private
address 192.168.1.220 and port 8000.
Untrust
zone Internet
Public address
space
ge-0/0/0
SRX Series device 203.0.113.0/24
ge-1/0/0
192.168.1.0/24
Trust
zone
Private address
space
Server Server
192.168.1.200 192.168.1.220
203.0.113.200 192.168.1.200
port 80 port 80
203.0.113.200 192.168.1.220
port 8000 port 8000
g030666
• Destination NAT pool dst-nat-pool-1 that contains the IP address 192.168.1.200 port
80.
• Destination NAT pool dst-nat-pool-2 that contains the IP address 192.168.1.220 and
port 8000.
• Destination NAT rule set rs1 with rule r1 to match packets received from the untrust
zone with the destination IP address 203.0.113.200 and destination port 80. For
matching packets, the destination address is translated to the address in the
dst-nat-pool-1 pool.
• Destination NAT rule set rs1 with rule r2 to match packets received from the untrust
zone with the destination IP address 203.0.113.200 and destination port 8000. For
matching packets, the destination IP address and port are translated to the address
and port in the dst-nat-pool-2 pool.
• Proxy ARP for the address 203.0.113.200/32. This allows the Juniper Networks security
device to respond to ARP requests received on the interface for that address.
• Security policies to permit traffic from the untrust zone to the translated destination
IP addresses in the trust zone.
Configuration
CLI Quick To quickly configure this example, copy the following commands, paste them into a text
Configuration file, remove any line breaks, change any details necessary to match your network
configuration, copy and paste the commands into the CLI at the [edit] hierarchy level,
and then enter commit from configuration mode.
Step-by-Step The following example requires you to navigate throughout various levels in the
Procedure configuration hierarchy. For instructions on how to do that, see Using the CLI Editor in
Configuration Mode.
3. Configure a rule that matches packets and translates the destination address to
the address in the pool.
4. Configure a rule that matches packets and translates the destination address to
the address in the pool.
7. Configure a security policy that allows traffic from the untrust zone to the servers
in the trust zone.
Results From configuration mode, confirm your configuration by entering the show security nat
and show security policies commands. If the output does not display the intended
configuration, repeat the configuration instructions in this example to correct it.
[edit]
user@host# show security nat
destination {
pool dst-nat-pool-1 {
address 192.168.1.200/32 port 80;
}
pool dst-nat-pool-2 {
address 192.168.1.220/32 port 8000;
}
rule-set rs1 {
from zone untrust;
rule r1 {
match {
destination-address 203.0.113.200/32;
destination-port 80;
}
then {
destination-nat pool dst-nat-pool-1;
}
}
rule r2 {
match {
destination-address 203.0.113.200/32;
destination-port 8000;
}
then {
destination-nat pool dst-nat-pool-2;
}
}
}
}
proxy-arp {
interface ge-0/0/0.0 {
address {
203.0.113.200/32;
}
}
}
user@host# show security policies
from-zone untrust to-zone trust {
policy server-access {
match {
source-address any;
destination-address [ server-1 server-2 ];
application any;
}
then {
permit;
}
}
}
If you are done configuring the device, enter commit from configuration mode.
Verification
Purpose Verify that there is traffic using IP addresses from the destination NAT pool.
Action From operational mode, enter the show security nat destination pool all command. View
the Translation hits field to check for traffic using IP addresses from the pool.
Purpose Verify that there is traffic matching the destination NAT rule.
Action From operational mode, enter the show security nat destination rule all command. View
the Translation hits field to check for traffic that matches the rule.
Action From operational mode, enter the show security flow session command.
Requirements
1. Configure network interfaces on the device. See Interfaces Feature Guide for Security
Devices.
2. Create security zones and assign interfaces to them. See Understanding Security Zones.
Overview
This example uses the trust security zone for the private address space and the untrust
security zone for the public address space. In Figure 11 on page 123, devices in the untrust
zone access devices in the trust zone by way of public subnet address 203.0.113.0/24.
For packets that enter the Juniper Networks security device from the untrust zone with
a destination IP address in the 203.0.113.0/24 subnet, the destination IP address is
translated to a private address on the 192.168.1.0/24 subnet.
Untrust
zone Internet
Public address
space
ge-0/0/0
SRX Series device 203.0.113.0/24
ge-1/0/0
192.168.1.0/24
Trust
zone
Private address
space 192.168.1.0/24
203.0.113.0/16 192.168.1.0/24
g030667
• Destination NAT rule set rs1 with rule r1 to match packets received from the ge-0/0/0.0
interface with the destination IP address on the 203.0.113.0/24 subnet. For matching
packets, the destination address is translated to the address in the dst-nat-pool-1 pool.
• Proxy ARP for the addresses 203.0.113.1/32 through 203.0.113.62/32 on the interface
ge-0/0/0.0; these are the IP addresses of the hosts that should be translated from
the 203.0.113.0/24 subnet. This allows the Juniper Networks security device to respond
to ARP requests received on the interface for those addresses. The address
203.0.113.0/24 is assigned to the interface itself, so this address is not included in the
proxy ARP configuration. The addresses that are not in the 203.0.113.1/32 through
203.0.113.62/32 range are not expected to be present on the network and would not
be translated.
• Security policies to permit traffic from the untrust zone to the translated destination
IP addresses in the trust zone.
Configuration
CLI Quick To quickly configure this example, copy the following commands, paste them into a text
Configuration file, remove any line breaks, change any details necessary to match your network
configuration, copy and paste the commands into the CLI at the [edit] hierarchy level,
and then enter commit from configuration mode.
Step-by-Step The following example requires you to navigate throughout various levels in the
Procedure configuration hierarchy. For instructions on how to do that, see Using the CLI Editor in
Configuration Mode.
To configure a destination NAT mapping from a public subnet address to a private subnet
address:
3. Configure a rule that matches packets and translates the destination address to
an address in the pool.
6. Configure a security policy that allows traffic from the untrust zone to the devices
in the trust zone.
Results From configuration mode, confirm your configuration by entering the show security nat
and show security policies commands. If the output does not display the intended
configuration, repeat the configuration instructions in this example to correct it.
[edit]
user@host# show security nat
destination {
pool dst-nat-pool-1 {
address 192.168.1.0/24;
}
rule-set rs1 {
from interface ge-0/0/0.0;
rule r1 {
match {
destination-address 203.0.113.0/24;
}
then {
destination-nat pool dst-nat-pool-1;
}
}
}
}
proxy-arp {
interface ge-0/0/0.0 {
address {
203.0.113.1/32 to 203.0.113.62/32;
}
}
}
user@host# show security policies
from-zone untrust to-zone trust {
policy internal-access {
match {
source-address any;
destination-address internal-net;
application any;
}
then {
permit;
}
}
}
If you are done configuring the device, enter commit from configuration mode.
Verification
Purpose Verify that there is traffic using IP addresses from the destination NAT pool.
Action From operational mode, enter the show security nat destination pool all command. View
the Translation hits field to check for traffic using IP addresses from the pool.
Purpose Verify that there is traffic matching the destination NAT rule.
Action From operational mode, enter the show security nat destination rule all command. View
the Translation hits field to check for traffic that matches the rule.
Action From operational mode, enter the show security flow session command.
Purpose View the destination Network Address Translation (NAT) summary table and the details
of the specified NAT destination address pool information.
Action Select Monitor>NAT> Destination NAT in the J-Web user interface, or enter the following
CLI commands:
Table 9 on page 127 summarizes key output fields in the destination NAT display.
Rules
Rule-set Name of the rule set. Select all rule sets or a specific rule set to display from
Name the list.
ID Rule ID number. –
IP protocol IP protocol. –
Pools
Pool Name The names of the pools. Select all pools or a specific pool to display from the
list.
ID ID of the pool. –
Static NAT
Static NAT maps network traffic from a static external IP address to an internal IP address
or network. It creates a static translation of real addresses to mapped addresses. Static
NAT provides internet connectivity to networking devices through a private LAN with an
unregistered private IP address.
Static NAT allows connections to be originated from either side of the network, but
translation is limited to one-to-one or between blocks of addresses of the same size. For
each private address, a public address must be allocated. No address pools are necessary.
• To map multiple IP addresses and specified ranges of ports to a same IP address and
different range of ports
The port address translation (PAT) is also supported by giving static mapping between
destination-port (range) and mapped-port (range).
NOTE: The original destination address, along with other addresses in source
and destination NAT pools, must not overlap within the same routing instance.
In NAT rule lookup, static NAT rules take precedence over destination NAT rules and
reverse mapping of static NAT rules take precedence over source NAT rules.
For all ALG traffic, except FTP, we recommend that you not use the static NAT rule
options source-address or source-port. Data session creation can fail if these options are
used because the IP address and the source port value, which is a random value, might
not match the static NAT rule. For FTP ALG traffic, the source-address option can be
used because an IP address can be provided to match the source address of a static NAT
rule.
When both source and destination addresses are configured as match conditions for a
rule, traffic is matched to both the source address and destination address. Because
static NAT is bidirectional, traffic in the opposite direction reverse matches the rule, and
the destination address of the traffic is matched to the configured source address.
If multiple static NAT rules overlap in the match conditions, the most specific rule is
chosen. For example, if rules A and B specify the same source and destination IP
addresses, but rule A specifies traffic from zone 1 and rule B specifies traffic from interface
ge-0/0/0, rule B is used to perform static NAT. An interface match is considered to be
more specific than a zone match, which is more specific than a routing instance match.
Because static NAT rules do not support overlapping addresses and ports, they should
not be used to map one external IP address to multiple internal IP addresses for ALG
traffic. For example, if different sites want to access two different FTP servers, the internal
FTP servers should be mapped to two different external IP addresses.
For the static NAT rule action, specify the translated address and (optionally) the routing
instance.
In NAT lookup, static NAT rules take precedence over destination NAT rules and reverse
mapping of static NAT rules takes precedence over source NAT rules.
1. Configure static NAT rules that align with your network and security requirements.
2. Configure NAT proxy ARP entries for IP addresses in the same subnet of the ingress
interface.
Requirements
1. Configure network interfaces on the device. See Interfaces Feature Guide for Security
Devices.
2. Create security zones and assign interfaces to them. See Understanding Security Zones.
Overview
This example uses the trust security zone for the private address space and the untrust
security zone for the public address space.
In Figure 12 on page 132, devices in the untrust zone access a server in the trust zone by
way of public address 203.0.113.200/32. For packets that enter the Juniper Networks
security device from the untrust zone with the destination IP address 203.0.113.200/32,
the destination IP address is translated to the private address 192.168.1.200/32. For a
new session originating from the server, the source IP address in the outgoing packet is
translated to the public address 203.0.113.200/32.
Untrust
zone Internet
Public address
space
ge-0/0/0
SRX Series device 203.0.113.0/24
ge-1/0/0
192.168.1.0/24
Trust
zone
Private address
space
Server
192.168.1.200
203.0.113.200/32 192.168.1.200/32
g030663
• Static NAT rule set rs1 with rule r1 to match packets from the untrust zone with the
destination address 203.0.113.200/32. For matching packets, the destination IP address
is translated to the private address 192.168.1.200/32.
• Proxy ARP for the address 203.0.113.200 on interface ge-0/0/0.0. This allows the
Juniper Networks security device to respond to ARP requests received on the interface
for that address.
Configuration
CLI Quick To quickly configure this example, copy the following commands, paste them into a text
Configuration file, remove any line breaks, change any details necessary to match your network
configuration, copy and paste the commands into the CLI at the [edit] hierarchy level,
and then enter commit from configuration mode.
Step-by-Step The following example requires you to navigate throughout various levels in the
Procedure configuration hierarchy. For instructions on how to do that, see Using the CLI Editor in
Configuration Mode.
2. Configure a rule that matches packets and translates the destination address in
the packets to a private address.
5. Configure a security policy that allows traffic from the untrust zone to the server in
the trust zone.
6. Configure a security policy that allows all traffic from the server in the trust zone to
the untrust zone.
Results From configuration mode, confirm your configuration by entering the show security nat
and show security policies commands. If the output does not display the intended
configuration, repeat the configuration instructions in this example to correct it.
[edit]
user@host# show security nat
static {
rule-set rs1 {
from zone untrust;
rule r1 {
match {
destination-address 203.0.113.200/32;
}
then {
static-nat prefix 192.168.1.200/32;
}
}
}
}
proxy-arp {
interface ge-0/0/0.0 {
address {
203.0.113.200/32;
}
}
}
user@host# show security policies
from-zone trust to-zone untrust {
policy permit-all {
match {
source-address server-1;
destination-address any;
application any;
}
then {
permit;
}
}
}
from-zone untrust to-zone trust {
policy server-access {
match {
source-address any;
destination-address server-1;
application any;
}
then {
permit;
}
}
}
If you are done configuring the device, enter commit from configuration mode.
Verification
Purpose Verify that there is traffic matching the static NAT rule set.
Action From operational mode, enter the show security nat static rule command. View the
Translation hits field to check for traffic that matches the rule.
Action From operational mode, enter the show security flow session command.
NOTE: Address blocks for static NAT mapping must be of the same size.
Requirements
1. Configure network interfaces on the device. See Interfaces Feature Guide for Security
Devices.
2. Create security zones and assign interfaces to them. See Understanding Security Zones.
Overview
This example uses the trust security zone for the private address space and the untrust
security zone for the public address space. In Figure 13 on page 137, devices in the untrust
zone access devices in the trust zone by way of public subnet address 203.0.113.0/24.
For packets that enter the Juniper Networks security device from the untrust zone with
a destination IP address in the 203.0.113.0/24 subnet, the destination IP address is
translated to a private address on the 192.168.1.0/24 subnet. For new sessions originating
from the 192.168.1.0/24 subnet, the source IP address in outgoing packets is translated
to an address on the public 203.0.113.0/24 subnet.
Untrust
zone Internet
Public address
space
ge-0/0/0
SRX Series device 203.0.113.200/32
ge-1/0/0
192.168.1.0/24
Trust
zone
Private address
space 192.168.1.0/24
203.0.113.200/32 192.168.1.0/24
g030664
• Static NAT rule set rs1 with rule r1 to match packets received on interface ge-0/0/0.0
with a destination IP address in the 203.0.113.0/24 subnet. For matching packets, the
destination address is translated to an address on the 192.168.1.0/24 subnet.
• Proxy ARP for the address ranges 203.0.113.1/32 through 203.0.113.249/32 on interface
ge-0/0/0.0. This allows the Juniper Networks security device to respond to ARP
requests received on the interface for those addresses. The address 203.0.113.250/32
is assigned to the interface itself, so this address is not included in the proxy ARP
configuration.
Configuration
CLI Quick To quickly configure this example, copy the following commands, paste them into a text
Configuration file, remove any line breaks, change any details necessary to match your network
configuration, copy and paste the commands into the CLI at the [edit] hierarchy level,
and then enter commit from configuration mode.
Step-by-Step The following example requires you to navigate throughout various levels in the
Procedure configuration hierarchy. For instructions on how to do that, see Using the CLI Editor in
Configuration Mode.
To configure a static NAT mapping from a private subnet address to a public subnet
address:
2. Configure a rule that matches packets and translates the destination address in
the packets to an address in a private subnet.
5. Configure a security policy that allows traffic from the untrust zone to the subnet
in the trust zone.
6. Configure a security policy that allows all traffic from the subnet in the trust zone
to the untrust zone.
Results From configuration mode, confirm your configuration by entering the show security nat
and show security policies commands. If the output does not display the intended
configuration, repeat the configuration instructions in this example to correct it.
[edit]
user@host# show security nat
static {
rule-set rs1 {
from interface ge-0/0/0.0;
rule r1 {
match {
destination-address 203.0.113.0/24;
}
then {
static-nat prefix 192.168.1.0/24;
}
}
}
}
proxy-arp {
interface ge-0/0/0.0 {
address {
203.0.113.1/32 to 203.0.113.249/32;
}
}
}
user@host# show security policies
from-zone trust to-zone untrust {
policy permit-all {
match {
source-address server-group;
destination-address any;
application any;
}
then {
permit;
}
}
}
from-zone untrust to-zone trust {
policy server-access {
match {
source-address any;
destination-address server-group;
application any;
}
then {
permit;
}
}
}
If you are done configuring the device, enter commit from configuration mode.
Verification
Purpose Verify that there is traffic matching the static NAT rule set.
Action From operational mode, enter the show security nat static rule command. View the
Translation hits field to check for traffic that matches the rule.
Action From operational mode, enter the show security flow session command.
Requirements
• Configure network interfaces on the device. See Interfaces Feature Guide for Security
Devices.
• Create security zones and assign interfaces to them. See Understanding Security Zones.
Overview
This example uses the trust security zone for the private address space and the untrust
security zone for the public address space.
In Figure 14 on page 142, devices in the untrust zone access a server in the trust zone by
way of public addresses 203.0.113.1/32, 203.0.113.1/32, and 203.0.113.3/32. For packets
that enter the Juniper Networks security device from the untrust zone with the destination
IP addresses 203.0.113.1/32, 203.0.113.1/32, and 203.0.113.3/32, the destination IP address
is translated to the private addresses 10.1.1.1/32,10.1.1.2/32, and 10.1.1.2/32.
Internet
10.1.1.1/32 10.1.1.2/32
Trust
zone
10.1.1.2/32
Private address
space
NOTE:
• To configure the destination port, you must use an IP address for the
destination address field instead of an IP address prefix.
• You must configure the destination port to configure the mapped port and
vice versa.
• Use the same number range for the ports while configuring the destination
port and the mapped port.
• If you do not configure the destination port and the mapped port, the IP
mapping will be the one-to-one mapping.
• Any address overlapping or any address and port overlapping is not allowed.
• Static NAT rule set rs1 with rule r1 to match packets from the untrust zone with the
destination address 203.0.113.1/32 and destination port 100 to 200. For matching
packets, the destination IP address is translated to the private address 10.1.1.1/32 and
mapped to port 300 to 400.
• Static NAT rule set rs1 with rule r2 to match packets from the untrust zone with the
destination address 203.0.113.1/32 and destination port 300 to 400. For matching
packets, the destination IP address is translated to the private address 10.1.1.2/32 and
mapped to port 300 to 400.
• Static NAT rule set rs1 with rule r3 to match packets from the untrust zone with the
destination address 203.0.113.3/32 and destination port 300. For matching packets,
the destination IP address is translated to the private address 10.1.1.2/32 and mapped
to port 200.
Configuration
CLI Quick To quickly configure this example, copy the following commands, paste them into a text
Configuration file, remove any line breaks, change any details necessary to match your network
configuration, copy and paste the commands into the CLI at the [edit] hierarchy level,
and then enter commit from configuration mode.
Step-by-Step The following example requires you to navigate throughout various levels in the
Procedure configuration hierarchy. For instructions on how to do that, see Using the CLI Editor in
Configuration Mode.
To configure a static NAT mapping from a private subnet address to a public subnet
address:
2. Configure a rule that matches packets and translates the destination address in
the packets to a private address.
3. Configure a rule that matches packets and translates the destination address in
the packets to a private address.
4. Configure a rule that matches packets and translates the destination address in
the packets to a private address.
Results
From configuration mode, confirm your configuration by entering the show security nat
command. If the output does not display the intended configuration, repeat the
configuration instructions in this example to correct it.
[edit]
security {
nat {
static {
rule-set rs {
from zone untrust;
rule r1 {
match {
destination-address 203.0.113.1/32;
destination-port 100 to 200;
}
then {
static-nat {
prefix {
10.1.1.1/32;
mapped-port 300 to 400;
}
}
}
}
rule r2 {
match {
destination-address 203.0.113.1/32;
destination-port 300 to 400;
}
then {
static-nat {
prefix {
10.1.1.2/32;
mapped-port 300 to 400;
}
}
}
}
rule r3 {
match {
destination-address 203.0.113.3/32;
destination-port 300;
}
then {
static-nat {
prefix {
10.1.1.2/32;
mapped-port 200;
}
}
}
}
}
}
}
}
If you are done configuring the device, enter commit from configuration mode.
Verification
Purpose Verify that there is traffic matching the static NAT rule set.
Action From operational mode, enter the show security nat static rule command. View the
Translation hits field to check for traffic that matches the rule.
Troubleshooting
Problem Static NAT port mapping configuration failures occur during a commit.
Invalid configurations with overlapped IP addresses and ports result in commit failure.
The following example shows invalid configurations with overlapped addresses and
ports:
set security nat static rule-set rs rule r1 then static-nat prefix 10.1.1.1
set security nat static rule-set rs rule r2 match destination-port 300 to 400
set security nat static rule-set rs rule r2 then static-nat prefix 10.1.1.2
set security nat static rule-set rs rule r2 then static-nat prefix mapped-port 300 to 400
set security nat static rule-set rs rule r1 match destination-port 100 to 200
set security nat static rule-set rs rule r1 then static-nat prefix 10.1.1.1
set security nat static rule-set rs rule r1 then static-nat prefix mapped-port 300 to 400
set security nat static rule-set rs rule r2 match destination-port 300 to 400
set security nat static rule-set rs rule r2 then static-nat prefix 10.1.1.1
set security nat static rule-set rs rule r2 then static-nat prefix mapped-port 390 to 490
The following error message was displayed when the aforementioned configuration was
submitted for commit:
Solution To configure the destination port, you must avoid any address overlapping or any address
and port overlapping. For an example of valid configuration, see “Configuration” on
page 143.
Action Select Monitor>NAT>Static NAT in the J-Web user interface, or enter the following CLI
command:
Table 10 on page 148 summarizes key output fields in the static NAT display.
Rule-set Name Name of the rule set. Select all rule sets or a specific rule set to
display from the list.
ID Rule ID number. –
Host routing Name of the routing instance from which the packet comes. –
instance
Network Address Translators (NATs) are well known to cause very significant problems
with applications that carry IP addresses in the payload. Applications that suffer from
this problem include Voice Over IP and Multimedia Over IP. Persistent NAT improves
NATs behavior and defines a set of NAT requirement behavior which is useful for VOIP
applications working. NAT64 is a translating mechanism used to translate IPv6 packets
to IPv4 packets and vice versa by translating the packet headers according to IP/ICMP
Translation Algorithm.
NAT64 is a mechanism for translating IPv6 packets to IPv4 packets and vice versa that
allows IPv6 clients to contact IPv4 servers using unicast UDP, TCP, or ICMP. It is an
enhancement of Network Address Translation-Protocol Translation (NAT-PT).
• Endpoint-independent mappings
NOTE: The mapping and filtering behaviors of NAT64 and persistent NAT
are identical.
The following types of persistent NAT can be configured on the Juniper Networks device:
• Any remote host—All requests from a specific internal IP address and port are mapped
to the same reflexive transport address. Any external host can send a packet to the
internal host by sending the packet to the reflexive transport address.
• Target host—All requests from a specific internal IP address and port are mapped to
the same reflexive transport address. An external host can send a packet to an internal
host by sending the packet to the reflexive transport address. The internal host must
have previously sent a packet to the external host’s IP address.
• Target host port—All requests from a specific internal IP address and port are mapped
to the same reflexive transport address. An external host can send a packet to an
internal host by sending the packet to the reflexive transport address. The internal host
must have previously sent a packet to the external host’s IP address and port.
You configure any of the persistent NAT types with source NAT rules. The source NAT
rule action can use a source NAT pool (with or without port translation) or an egress
interface. Persistent NAT is not applicable for destination NAT, because persistent NAT
bindings are based on outgoing sessions from internal to external.
NOTE: Port overloading is used in Junos OS only for normal interface NAT
traffic. Persistent NAT does not support port overloading, and you must
explicitly disable port overloading with one of the following options at the
[edit security nat source] hierarchy level:
• port-overloading off
• port-overloading-factor 1
To configure security policies to permit or deny persistent NAT traffic, you can use two
new predefined services—junos-stun and junos-persistent-nat.
NOTE: Persistent NAT is different from the persistent address feature (see
“Understanding Persistent Addresses for Source NAT Pools” on page 78).
The persistent address feature applies to address mappings for source NAT
pools configured on the device. The persistent NAT feature applies to address
mappings on an external NAT device, and is configured for a specific source
NAT pool or egress interface. Also, persistent NAT is intended for use with
STUN client/server applications.
Also, a NAT firewall does not maintain a pinhole for incoming SIP messages. This forces
the SIP application to either constantly refresh the pinhole with SIP messages or use an
ALG to track registration, a function that may or may not be supported by the gateway
device.
The Session Traversal Utilities for NAT (STUN) protocol, first defined in RFC 3489, Simple
Traversal of User Datagram Protocol (UDP) Through Network Address Translators (NATs)
and then later in RFC 5389, Session Traversal Utilities for NAT, is a simple client/server
protocol. A STUN client sends requests to a STUN server, which returns responses to the
client. A STUN client is usually part of an application that requires a public IP address
and/or port. STUN clients can reside in an end system such as a PC or in a network server
whereas STUN servers are usually attached to the public Internet.
NOTE: Both the STUN client and STUN server must be provided by the
application. Juniper Networks does not provide a STUN client or server.
• Learn the reflexive transport address, which is the IP address and port binding allocated
by NAT device closest to the STUN server. (There may be multiple levels of NAT
between the STUN client and the STUN server.)
The client application can use the IP address binding information within protocols such
as SIP and H.323.
Figure 15 on page 154 illustrates the 464XLAT architecture, whereby IPv4 packets are
translated to IPv6 packets on the customer-side translator (CLAT), then go across the
IPv6-only network, and are translated back to IPv4 packets on the provider-side translator
(PLAT) to access global IPv4-only content in the core network. This architecture uses a
combination of stateless translation on the CLAT and stateful translation on the PLAT.
When an SRX Series device functions as a PLAT, it is responsible for keeping the sticky
mapping relationship between one specific IPv6 prefix and one translated IPv4 address.
The SRX Series device treats the IPv6 prefix as a single user. This mapping is accomplished
by configuring the specific IPv6 prefix length in an IPv4 source NAT pool using the
address-persistent feature.
Figure 16 on page 155 illustrates a NAT rule configured in the CLAT, which translates an
IPv4 address to an IPv6 address with an address-persistent prefix. With stateless NAT46
translation on the CLAT and stateful NAT64 translation on the PLAT, the traffic from
IPv4 host 192.168.1.2 reaches the global server 198.51.100.1 over an IPv6-only network.
Table 11 on page 155 lists other NAT features and their compatibility with the
address-persistent feature.
Table 11: NAT Feature Compatibility with the Address Persistent Feature
Feature Compatible
Non-PAT pools No
Port-overloading Yes
Deterministic NAT No
ALG Yes
(Existing ALG NAT translations , such as FTP/PPTP/RTSP/DNS/SIP from native IPv6 clients.)
• The type of persistent NAT—One of the following: any remote host, target host, or
target host port.
You can only specify the address-mapping option when the persistent NAT type is any
remote host and the source NAT rule action is one of the following actions:
• (Optional) Inactivity timeout—Time, in seconds, that the persistent NAT binding remains
in the device’s memory when all the sessions of the binding entry have expired. When
the configured timeout is reached, the binding is removed from memory. The default
value is 300 seconds. Configure a value from 60 through 7200 seconds.
When all sessions of a persistent NAT binding have expired, the binding remains in a
query state in the SRX Series device’s memory for the specified inactivity timeout
period. The query binding is automatically removed from memory when the inactivity
timeout period expires (the default is 300 seconds). You can explicitly remove all or
specific persistent NAT query bindings with the clear security nat source
persistent-nat-table command.
For interface NAT, you need to explicitly disable port overloading with one of the following
options at the [edit security nat source] hierarchy level:
• port-overloading off
• port-overloading-factor 1
Finally, there are two predefined services that you can use in security policies to permit
or deny STUN and persistent NAT traffic:
For the any remote host persistent NAT type, the direction of the security policy is from
external to internal. For target host or target host port persistent NAT types, the direction
of the security policy is from internal to external.
Requirements
Before you begin, be sure the existing NAT rules and pool configuration do not conflict
with the new one.
Overview
In this example, you configure an IPv6 prefix length of /64 in an IPv4 source NAT pool
for NAT IPv6 to IPv4 translations. Traffic matching the NAT rule and NAT pool perform
address persistent translation between the IPv6 prefix and the IPv4 translated address.
This configuration can be used on the provider-side translator (PLAT) in a dual-translation
scenario, 464XLAT, to enable IPv4 services to work over IPv6-only networks.
Configuration
CLI Quick To quickly configure this example, copy the following commands, paste them into a text
Configuration file, remove any line breaks, change any details necessary to match your network
configuration, copy and paste the commands into the CLI at the [edit] hierarchy level,
and then enter commit from configuration mode.
Step-by-Step The following example requires you to navigate throughout various levels in the
Procedure configuration hierarchy. For instructions on how to do that, see Using the CLI Editor in
Configuration Mode.
2. Specify the IPv6 prefix length for the source NAT pool.
Results From configuration mode, confirm your configuration by entering the show security nat
command. If the output does not display the intended configuration, repeat the
configuration instructions in this example to correct it.
[edit]
user@host# show security nat
source {
pool NAT64 {
address {
198.51.100.240/32 to 198.51.100.254/32;
}
address-persistent subscriber ipv6-prefix-length 64;
}
rule-set RS1 {
from zone trust;
to zone untrust;
rule R1 {
match {
source-address 2001:db8::/32;
destination-address 198.51.100.198/32;
}
then {
source-nat {
pool {
NAT64;
}
}
}
}
}
}
If you are done configuring the device, enter commit from configuration mode.
Verification
Purpose Verify that the same IPv6 prefix is translated to the persistent IPv4 address.
Action From operational mode, enter the show security flow session command.
Example: Supporting Network Configuration By Configuring Persistent NAT with Interface NAT
You can configure any of the persistent NAT types with source NAT rules. This example
illustrates how to apply persistent NAT with an interface IP address and how to use an
interface IP address as a NAT IP address to perform persistent NAT for a specific internal
host. It also shows how to maintain persistent address port mapping behavior and
persistent NAT filter behavior for the host. You must disable port overloading for interface
NAT.
Requirements
• 4 PCs
• Understand the concepts of persistent NAT. See “Persistent NAT and NAT64
Configuration Overview” on page 155.
Overview
In a Carrier Grade NAT (CGN) network deployment, you can configure the interface IP
address as a NAT address to perform persistent network address translation. In this way,
the internal host can create one source NAT mapping relationship by the outgoing traffic
initiated from internal to external. Then the external host sends traffic back to this internal
host by sending the traffic to this interface NAT address through the shared NAT mapping
relationship.
In this example, you first configure the interface NAT rule set int1 to match traffic from
interface ge-0/0/1 to interface ge-0/0/2, and then you configure the NAT rule in1 to
match the specific source and destination addresses to perform persistent NAT. You
configure the any remote host persistent NAT type when interface NAT is performed.
For packets with source address 192.0.2.0/24 (internal phones) and destination address
198.51.100.0/24 (including STUN server, SIP proxy server, and external phones), you
configure interface NAT with the any remote host persistent NAT type. Then you disable
port overloading for interface NAT.
Next, you configure a security policy to allow persistent NAT traffic from the external
network (external zone) to the internal network (internal zone) for any of the remote
host persistent NAT types.
Topology
Parameter Description
Parameter Description
Configuration
CLI Quick To quickly configure this example, copy the following commands, paste them into a text
Configuration file, remove any line breaks, change any details necessary to match your network
configuration, copy and paste the commands into the CLI at the [edit] hierarchy level,
and then enter commit from configuration mode.
Step-by-Step The following example requires you to navigate various levels in the configuration
Procedure hierarchy. For instructions on how to do that, see Using the CLI Editor in Configuration
Mode in the CLI User Guide.
[edit security]
user@host# set nat source interface port-overloading off
3. Configure a security policy to allow STUN traffic from internal SIP phones to an
external STUN server.
4. Configure a security policy to allow SIP proxy traffic from internal SIP phones to an
external SIP proxy server.
5. Configure a security policy to allow SIP traffic from external SIP phones to internal
SIP phones.
Results From configuration mode, confirm your configuration by entering the show security nat
and show security policies commands. If the output does not display the intended
configuration, repeat the instructions in this example to correct the configuration.
[edit]
user@host# show security nat
source {
interface {
port-overloading off;
}
rule-set int1 {
from interface ge-0/0/1.0;
to interface ge-0/0/2.0;
rule in1 {
match {
source-address 192.0.2.0/24;
destination-address 198.51.100.0/24;
}
then {
source-nat {
interface {
persistent-nat {
permit any-remote-host;
}
}
}
}
}
}
}
[edit]
user@host# show security policies
from-zone internal to-zone external {
policy stun_traffic {
match {
source-address internal_phones;
destination-address stun_server;
application junos-stun;
}
then {
permit;
}
}
policy sip_proxy_traffic {
match {
source-address internal_phones;
destination-address sip_proxy_server;
application junos-sip;
}
then {
permit;
}
}
policy sip_traffic {
match {
source-address internal_phones;
destination-address external_phones;
application junos-persistent-nat;
}
then {
permit;
}
}
}
If you are done configuring the device, enter commit from configuration mode.
Verification
Purpose Verify that all the rules are matched and used.
Action From operational mode, enter the show security nat source persistent-nat-table all
command.
Action From operational mode, enter the show security flow session command.
Bytes: 0
Meaning The show security flow session command displays active sessions on the device and each
session’s associated security policy. The output shows traffic entering the device using
the private source address 192.0.2.12 destined to a public host at 198.51.100.45. The return
traffic from this flow travels to the translated public address 198.51.100.1.
• Session ID—Number that identifies the session. Use this ID to get more information
about the session such as policy name or number of packets in and out.
• sip_proxy_traffic— Policy name that permitted the SIP traffic from the internal SIP
phones to the external SIP proxy server.
• In—Incoming flow (source and destination IP addresses with their respective source
and destination port numbers. The session is UDP, and the source interface for this
session is ge-0/0/1.0).
• Out—Reverse flow (source and destination IP addresses with their respective source
and destination port numbers. The session is UDP, and the destination interface for
this session is ge-0/0/2.0).
• stun_traffic—Policy name that permitted the STUN traffic from the internal SIP phones
to the external STUN server.
Requirements
• Ensure that the existing NAT rule and pool configuration do not conflict with the new
ones.
Overview
In this example you use NAT64 to send packets from the IPv6 internal host to the IPv4
external host and from the IPv4 external host to the IPv4 internal host.
Configuration
CLI Quick To quickly configure this example, copy the following commands, paste them into a text
Configuration file, remove any line breaks, change any details necessary to match your network
configuration, copy and paste the commands into the CLI at the [edit] hierarchy level,
and then enter commit from configuration mode.
Step-by-Step The following example requires you to navigate various levels in the configuration
Procedure hierarchy. For instructions on how to do that, see Using the CLI Editor in Configuration
Mode.
4. Define a source address pool and add the address to the pool.
Results From configuration mode, confirm your configuration by entering the show nat source
command. If the output does not display the intended configuration, repeat the
configuration instructions in this example to correct it.
[edit security]
user@host#show nat source
pool myipv4 {
address {
203.0.113.2/32;
}
}
rule-set test_rs {
rule test_rule {
match {
destination-address 2001:db8::/128;
}
}
rule-set myipv4_rs {
If you are done configuring the device, enter commit from configuration mode.
Verification
Purpose Verify that all the rules are matched and used.
Action From operational mode, enter the show security nat source persistent-nat-table all
command.
Requirements
• Ensure that the existing NAT rules and pool configuration do not conflict with the new
ones.
Overview
In this example you use NAT64 to send packets from the IPv6 internal host to the IPv4
external host and from the IPv4 external host to the IPv4 internal host.
Configuration
CLI Quick To quickly configure this example, copy the following commands, paste them into a text
Configuration file, remove any line breaks, change any details necessary to match your network
configuration, copy and paste the commands into the CLI at the [edit] hierarchy level,
and then enter commit from configuration mode.
Step-by-Step The following example requires you to navigate various levels in the configuration
Procedure hierarchy. For instructions on how to do that, see Using the CLI Editor in Configuration
Mode.
4. Define a source address pool and add the address to the pool.
user@host# set source rule-set myipv4_rs rule ipv4_rule then source-nat pool myipv4
Results From configuration mode, confirm your configuration by entering the show nat source
command. If the output does not display the intended configuration, repeat the
configuration instructions in this example to correct it.
[edit security]
user@host#show nat source
pool myipv4 {
address {
203.0.113.2/32;
}
}
rule-set test_rs {
rule test_rule {
match {
destination-address 2001:db8::/128;
}
}
rule-set myipv4_rs {
from interface ge-0/0/1.0;
to interface ge-0/0/2.0;
rule ipv4_rule {
match {
source-address 2001:db8::/96;
destination-address 10.2.2.15/32;
}
then {
source-nat {
pool {
myipv4;
persistent-nat {
permit any-remote-host;
}
}
}
}
}
}
}
If you are done configuring the device, enter commit from configuration mode.
Verification
Purpose Verify that all the rules are matched and used.
Action From operational mode, enter the show security nat source persistent-nat-table all
command.
Requirements
Before you begin, see “Understanding Persistent NAT and NAT64” on page 152.
Overview
In this example, you enable the maximize persistent NAT capacity option. This option is
supported only on Services Processing Cards (SPCs) for SRX1400 devices with
SRX1K-NPC-SPC-1-10-40, SRX3000 Series devices with SRX3K-SPC-1-10-40, and
SRX5000 Series devices with SRX5K-SPC-2-10-40SPC and SRX5K-SPC3. Note that
for the SRX5000 Series devices with SRX5K-SPC-2-10-40SPC and SPC3, the persistent
NAT binding number is maximized at the cost of reducing the maximum session number.
To enable this option, the supported central point maximum binding capacity can be
approximately increased to 1/8 of the central point session capacity up to 2M and the
By default, the persistent NAT binding capacity on both the central point and the SPU
of an SRX5400, SRX5600, or SRX5800 device is 64,000. In this example, you enable
the session capacity to maximum 20,000,000 on the central point and maximum
1,100,000 on each of the SPUs with maximum session configuration. If you enable the
maximize-persistent-nat-capacity option, an SRX5400, SRX5600, or SRX5800 device
with 4 GB of memory can support maximum 2M persistent NAT bindings on the central
point and 275,000 bindings on each of the SPUs.
Configuration
[edit]
user@host# set security forwarding-process application-services
maximize-persistent-nat-capacity
[edit]
user@host# commit
[edit]
user@host# request system reboot
4. If you want to switch the device back to regular mode, delete the maximize persistent
NAT capacity mode configuration.
[edit]
user@host# delete security forwarding-process application-services
maximize-persistent-nat-capacity
Verification
Purpose Verify that you have increased the persistent NAT capacity.
Action From operational mode, enter the show security forwarding-process application-services
command.
Generally, a source host in a subnetwork may not recognize that the traffic is intended
for a destination host within the same subnetwork, because it identifies the destination
host only by its public IP address. The NAT analyzes the IP packets and routes the packet
back to the correct host.
NAT hairpinning support is required if two hosts on the internal network want to
communicate with each other by using a binding on the NAT device. In this case, the NAT
device receives a packet from the internal network and forwards it back to the internal
network. If hairpinning is not supported, forwarding the packet will fail and it will be
dropped.
NOTE:
• NAT hairpinning behavior is not supported by target host persistent NAT
and target host port persistent NAT. Only any remote host persistent NAT
supports hairpinning behavior.
• Persistent NAT hairpinning applies only to any remote host persistent NAT
type.
Example: Configuring Persistent NAT Hairpinning with Source NAT Pool with Address Shifting
This example shows how to configure persistent NAT hairpinning.
Requirements
• Configure network interfaces on the device. See Interfaces Feature Guide for Security
Devices.
• Create security zones and assign interfaces to them. See Understanding Security Zones.
Overview
Hairpinning allows packets from the private network to be translated and then looped
back to the private network rather than being passed through to the public network.
Hairpinning feature enables using a corresponding record in the NAT table to recognize
that a packet is addressed to a host in the local network. Then it translates the destination
IP address and sends the packet back to the local network (as well as in case of port
mapping). This ensures that traffic between the two hosts work properly.
Hairpinning enables two endpoints (Host 1 and Host 2) on the private network to
communicate even if they only use each other’s external IP addresses and ports. This is
explained in Figure 18 on page 176.
When Host 1 sends traffic to Host 3, a NAT binding between Host 1’s internal source IP
address and port is associated in the NAT table with its external IP address and port. The
same thing happens when Host 2 sends traffic to Host 3. In this way, when Host 1 and
Host 2 want to communicate, they can identify each other’s external IP addresses.
For example, if Host 1 communicates with Host 2, NAT (with hairpinning support) is used
to route the packets, which contain Host 2’s external address, back to Host 2’s internal
address.
Host 3
reth1z zone
198.51.100.2/24
Binding 1: 10.10.10.2, 69 192.0.2.1, 69
Binding 2: 10.10.10.10, 69 192.0.2.9, 69
SRX Series Device 198.51.100.254/24
10.10.10.254/24
10.10.10.2/24 10.10.10.10/24
Host 1 Host 2
g030696
reth0z zone
• Host 1 and Host 2 are in zone reht0z, and Host 3 is in reth1z zone
Table 13 on page 176 shows the binding table used in this example.
Configuration
[edit]
user@host# set interfaces ge-11/0/0 unit 0 family inet address 10.10.10.254/24
[edit]
user@host# set security zones security-zone reth0z host-inbound-traffic
system-services all
user@host# set security zones security-zone reth0z host-inbound-traffic protocols
all
user@host# set security zones security-zone reth0z interfaces ge-11/0/0.0
user@host# set security zones security-zone reth1z host-inbound-traffic
system-services all
user@host# set security zones security-zone reth1z host-inbound-traffic protocols
all
user@host# set security zones security-zone reth1z interfaces ge-11/0/1.0
[edit]
user@host# set security address-book global address subnet10 10.10.10.0/24
user@host# set security address-book global address subnet20 198.51.100.0/24
user@host# set security policies from-zone reth0z to-zone reth1z policy p1 match
source-address subnet10
user@host# set security policies from-zone reth0z to-zone reth1z policy p1 match
destination-address subnet20
user@host# set security policies from-zone reth0z to-zone reth1z policy p1 match
application any
user@host# set security policies from-zone reth0z to-zone reth1z policy p1 then
permit
user@host# set security policies default-policy deny-all
user@host# set security policies from-zone reth0z to-zone reth0z policy p2 match
source-address subnet10
user@host# set security policies from-zone reth0z to-zone reth0z policy p2 match
destination-address subnet10
user@host# set security policies from-zone reth0z to-zone reth0z policy p2 match
application any
user@host# set security policies from-zone reth0z to-zone reth0z policy p2 then
permit
[edit]
user@host# set security nat source pool src1 address 192.0.2.1/32 to 192.0.2.10/32
6. Specify the beginning of the original source IP address range for Host 1 and Host 2
(src1).
[edit]
user@host# set security nat source pool src1 host-address-base 10.10.10.2/24
[edit]
user@host# set security nat source rule-set r1 from zone reth0z
user@host# set security nat source rule-set r1 to zone reth1z
user@host# set security nat source rule-set r1 to zone reth0z
user@host# set security nat source rule-set r1 rule rule1 match source-address
10.10.10.0/24
user@host# set security nat source rule-set r1 rule rule1 match destination-address
10.10.10.0/24
user@host# set security nat source rule-set r1 rule rule1 match destination-address
198.51.100.0/24
user@host# set security nat source rule-set r1 rule rule1 then source-nat pool src1
user@host# set security nat source rule-set r1 rule rule1 then source-nat pool
persistent-nat permit any-remote-host
user@host# set security nat source rule-set r1 rule rule1 then source-nat pool
persistent-nat inactivity-timeout 900
user@host# set security nat source rule-set r1 rule rule1 then source-nat pool
persistent-nat max-session-number 20
Results From configuration mode, enter the show security nat command to confirm your
configuration. If the output does not display the intended configuration, repeat the
configuration instructions in this example to correct it.
[edit]
user@host# show security nat
source {
pool src1 {
address {
192.0.2.1/32 to 192.0.2.10/32;
}
host-address-base 10.10.10.2/24;
}
rule-set r1 {
from zone reth0z;
to zone [ reth0z reth1z ];
rule rule1 {
match {
source-address 10.10.10.0/24;
destination-address [10.10.10.0/24 198.51.100.0/24];
}
then {
source-nat {
pool {
src1;
persistent-nat {
permit any-remote-host;
inactivity-timeout 900;
max-session-number 20;
}
}
}
}
}
}
}
If you are done configuring the device, enter commit from configuration mode.
Verification
Purpose Verify traffic sent from between the hosts (Host 1 and Host 3) creating binding 1.
sendip -d r28 -p ipv4 -iv 4 -is 10.10.10.2 -id 198.51.100.2 -p udp -us 69 -ud
69 198.51.100.2
Source-IP: 10.10.10.2
Source-port: 69
Dst-IP: 198.51.100.2
Dst-port: 69
Binding1 is below:
Purpose Verify traffic sent from between the hosts (Host 2 and Host 3) creating binding 2.
sendip -d r28 -p ipv4 -iv 4 -is 10.10.10.10 -id 198.51.100.2 -p udp -us 69 -ud
69 198.51.100.2
Source-IP: 10.10.10.10
Source-port: 69
Dst-IP: 198.51.100.2
Dst-port: 69
Binding2 is below:
sendip -d r28 -p ipv4 -iv 4 -is 10.10.10.2 -id 192.0.2.9 -p udp -us 69 -ud 69
192.0.2.9
To implement multicast group address translation, either static NAT or destination NAT
is used. With the help of NAT, source addresses in IPv4 are translated to IPv4 multicast
group destination addresses.
Either static NAT or destination NAT can be used to perform multicast group address
translation. Static NAT allows connections to be originated from either side of the network,
but translation is limited to one-to-one addresses or between blocks of addresses of the
same size. No address pools are necessary. Use the static configuration statement at
the [edit security nat] hierarchy level to configure static NAT rule sets for multicast traffic.
Destination NAT allows connections to be initiated only for incoming network
connections—for example, from the Internet to a private network. Use the destination
configuration statement at the [edit security nat] hierarchy level to configure destination
NAT pools and rule sets.
Source NAT for multicast traffic is supported only by using IP address shifting to translate
the original source IP address to an IP address from a user-defined address pool. This
type of translation is one-to-one, static, and without port address translation. If the
original source IP address range is larger than the IP address range in the user-defined
pool, untranslated packets are dropped. The mapping does not provide bidirectional
mapping, which static NAT provides. Use the source configuration statement at the [edit
security nat] hierarchy level to configure source NAT pools and rule sets. When you define
the source NAT pool for this type of source NAT, use the host-address-base option to
specify the start of the original source IP address range.
This example shows how to configure a Juniper Networks device for address translation
of multicast flows.
Requirements
1. Configure network interfaces on the device. See the Interfaces Feature Guide for Security
Devices.
2. Create security zones and assign interfaces to them. See Understanding Security Zones.
Overview
This example uses the trust security zone for the private address space and the untrust
security zone for the public address space. Figure 19 on page 183 depicts a typical
deployment of the Juniper Networks device for multicast forwarding. The source router
R1 sends multicast packets with source addresses in the range 203.0.113.100 through
203.0.113.110 and the group address 233.252.0.1/32 toward the Juniper Networks device.
The source router R1 is in the private network (trust zone) upstream of the Juniper
Networks device. There are several receivers in the public network (untrust zone)
downstream of the device.
The Juniper Networks device translates incoming multicast packets from R1 before
forwarding them out on the downstream interfaces. The following translations are applied:
• For the interface to R2, the source address is untranslated, and the group address is
translated to 233.252.0.2/32.
• For the interface to R3, the source address is translated to an address in the range
198.51.100.200 through 198.51.100.210, and the group address is translated to
233.252.0.2/32.
• For the interface to R4, the source address is translated to an address in the range
10.10.10.100 through 10.10.10.110, and the group address is translated to 233.252.0.2/32.
R1
Trust
Private address space zone
Untrust
Public address space zone
R2 R3 R4
From R1 To R2 To R3 To R4
• Destination NAT rule set rs1 with rule r1 to match packets arriving on interface xe-2/0/1.0
with the destination IP address 233.252.0.1/32. For matching packets, the destination
address is translated to the IP address in the dst-nat-pool pool.
• Source NAT pool src-nat-shift-1 that contains the IP address range 198.51.100.200/32
through 198.51.100.210/32. For this pool, the beginning of the original source IP address
range is 203.0.113.100/32 and is specified with the host-address-base option.
• Source NAT rule set rs-shift1 with rule r1 to match packets from the trust zone to
interface xe-1/0/1.0 with a source IP address in the 203.0.113.96/28 subnet. For
matching packets that fall within the source IP address range specified by the
src-nat-shift-1 configuration, the source address is translated to the IP address in the
src-nat-shift-1 pool.
• Source NAT pool src-nat-shift-2 that contains the IP address range 10.10.10.100/32
through 10.10.10.110/32. For this pool, the beginning of the original source IP address
range is 203.0.113.100/32 and is specified with the host-address-base option.
• Source NAT rule set rs-shift2 with rule r1 to match packets from the trust zone to
interface xe-2/0/0.0 with a source IP address in the 203.0.113.96/28 subnet. For
matching packets that fall within the source IP address range specified by the
src-nat-shift-2 configuration, the source address is translated to the IP address in the
src-nat-shift-2 pool.
• Proxy ARP for the addresses 203.0.113.100 through 203.0.113.110 on interface xe-1/0/0.0,
addresses 198.51.100.200 through 198.51.100.210 on interface xe-1/0/1.0, and addresses
10.10.10.100 through 10.10.10.110 on interface xe-2/0/0.0. This allows the Juniper
Networks security device to respond to ARP requests received on the interface for
those addresses.
• Security policy to permit traffic from the trust zone to the untrust zone.
• Security policy to permit traffic from the untrust zone to the translated destination IP
address in the trust zone.
Configuration
CLI Quick To quickly configure this example, copy the following commands, paste them into a text
Configuration file, remove any line breaks, change any details necessary to match your network
configuration, copy and paste the commands into the CLI at the [edit] hierarchy level,
and then enter commit from configuration mode.
Step-by-Step The following example requires you to navigate various levels in the configuration
Procedure hierarchy. For instructions on how to do that, see Using the CLI Editor in Configuration
Mode.
To configure the destination and source NAT translations for multicast flows:
3. Configure a rule that matches packets and translates the destination address to
the address in the destination NAT pool.
7. Configure a rule that matches packets and translates the destination address to
the address in the source NAT pool.
11. Configure a rule that matches packets and translates the destination address to
the address in the source NAT pool.
13. Configure a security policy that allows traffic from the trust zone to the untrust zone.
14. Configure a security policy that allows traffic from the untrust zone to the trust zone.
Results From configuration mode, confirm your configuration by entering the show security nat
and show security policies commands. If the output does not display the intended
configuration, repeat the configuration instructions in this example to correct it.
[edit]
user@host# show security nat
source {
pool src-nat-shift-1 {
address {
198.51.100.200/32 to 198.51.100.210/32;
}
host-address-base 203.0.113.100/32;
}
pool src-nat-shift-2 {
address {
10.10.10.100/32 to 10.10.10.110/32;
}
host-address-base 203.0.113.100/32;
}
rule-set trust-to-untrust {
from zone trust;
to zone untrust;
rule source-nat-rule {
match {
source-address 0.0.0.0/0;
}
then {
source-nat {
interface;
}
}
}
}
rule-set rs-shift1 {
from zone trust;
to interface xe-1/0/1.0;
rule r1 {
match {
source-address 203.0.113.96/28;
}
then {
source-nat {
pool {
src-nat-shift1;
}
}
}
}
}
rule-set rs-shift2 {
from zone trust;
to interface xe-2/0/0.0;
rule r2 {
match {
source-address 203.0.113.96/28;
}
then {
source-nat {
pool {
src-nat-shift2;
}
}
}
}
}
}
destination {
pool dst-nat-pool {
address 233.252.0.1/32;
}
rule-set rs1 {
from interface xe-2/0/1.0;
rule r1 {
match {
destination-address 233.252.0.1/32;
}
then {
destination-nat pool dst-nat-pool;
}
}
}
}
proxy-arp {
interface xe-1/0/0.0 {
address {
203.0.113.100/32 to 203.0.113.110/32;
}
}
interface xe-1/0/1.0 {
address {
198.51.100.200/32 to 198.51.100.210/32;
}
}
interface xe-2/0/0.0 {
address {
10.10.10.100/32 to 10.10.10.110/32;
}
}
}
[edit]
user@host# show security policies
from-zone trust to-zone untrust {
policy trust-to-untrust {
match {
source-address any;
destination-address any;
application any;
}
then {
permit;
}
}
policy internet-access {
match {
source-address any;
destination-address any;
application any;
}
then {
permit;
}
}
from-zone untrust to-zone trust {
policy dst-nat-pool-access {
match {
source-address any;
destination-address 233.252.0.1/21;
application any;
}
then {
permit;
}
}
}
}
If you are done configuring the device, enter commit from configuration mode.
Verification
Purpose Verify that there is traffic using IP addresses from the destination NAT pool.
Action From operational mode, enter the show security nat destination pool all command. View
the Translation hits field to check for traffic using IP addresses from the pool.
Purpose Verify that there is traffic matching the destination NAT rule.
Action From operational mode, enter the show security nat destination rule all command. View
the Translation hits field to check for traffic that matches the rule.
Purpose Verify that there is traffic using IP addresses from the source NAT pool.
Action From operational mode, enter the show security nat source pool all command. View the
Translation hits field to check for traffic using IP addresses from the pool.
Purpose Verify that there is traffic matching the source NAT rule.
Action From operational mode, enter the show security nat source rule all command. View the
Translation hits field to check for traffic that matches the rule.
Action From operational mode, enter the show security flow session command.
IPv6 NAT
IPv6 NAT helps to translate IPv4 addresses to IPv6 addresses of network devices. IPv6
NAT also helps to translate the address between IPv6 hosts. IPv6 NAT supports source
NAT, destination NAT, and static NAT.
• Source NAT
• Destination NAT
• Static NAT
Source NAT is the translation of the source IP address of a packet leaving the Juniper
Networks device. Source NAT is used to allow hosts with private IP addresses to access
a public network.
• Translation of one IPv6 subnet to another IPv6 subnet without port address translation
• Translation of IPv6 hosts to IPv6 hosts with or without port address translation
• Translation of IPv6 hosts to IPv4 hosts with or without port address translation
• Translation of IPv4 hosts to IPv6 hosts with or without port address translation
Destination NAT is the translation of the destination IP address of a packet entering the
Juniper Networks device. Destination NAT is used to redirect traffic destined to a virtual
host (identified by the original destination IP address) to the real host (identified by the
translated destination IP address).
• Mapping of one IPv6 host (and optional port number) to one special IPv6 host (and
optional port number)
• Mapping of one IPv6 host (and optional port number) to one special IPv4 host (and
optional port number)
• Mapping of one IPv4 host (and optional port number) to one special IPv6 host (and
optional port number)
Static NAT defines a one-to-one mapping from one IP subnet to another IP subnet. The
mapping includes destination IP address translation in one direction and source IP address
translation in the reverse direction. From the NAT device, the original destination address
is the virtual host IP address while the mapped-to address is the real host IP address.
In basic NAT-PT, a block of IPv4 addresses at an IPv4 interface is set aside for
translating addresses as IPv6 hosts as they initiate sessions to the IPv4 hosts. The
basic NAT-PT translates the source IP address and related fields such as IP, TCP, UDP,
and ICMP header checksums for packets outbound from the IPv6 domain . For inbound
packets, it translates the the destination IP address and the checksums.
NOTE: The SRX Series devices partially support the bidirectional NAT-PT
specification. It supports flow of bidirectional traffic assuming that there
are other ways to convey the mapping between the IPv6 address and the
dynamically allocated IPv4 address. For example, a local DNS can be
configured with the mapped entries for IPv4 nodes to identify the addresses.
NAT- PT Operation—The SRX Series devices support the traditional NAT-PT and allow
static mapping for the user to communicate from IPv4 to IPv6 . The user needs to statically
configure the DNS server with an IPv4 address for the hostname and then create a static
NAT on the device for the IPv6-only node to communicate from an IPv4-only node to an
IPv6-only node based on the DNS.
To support the dynamic address binding, a DNS should be used for name resolution. The
IPv4 host looks up the name of the IPv6 node in its local configured IPv4 DNS server,
which then passes the query to the IPv6 DNS server through an SRX Series device using
NAT-PT.
• Stores a mapping of the allocated IPv4 address to the IPv6 address returned in the
IPv6 address resolution so that the session can be established from any-IPv4 hosts to
the IPv6 host.
Requirements
Before you begin, configure interfaces and assign them to security zones.
Overview
Configuration
CLI Quick To quickly configure this example, copy the following commands, paste them into a text
Configuration file, remove any line breaks, change any details necessary to match your network
configuration, copy and paste the commands into the CLI at the [edit] hierarchy level,
and then enter commit from configuration mode.
Step-by-Step The following example requires you to navigate various levels in the configuration
Procedure hierarchy. For instructions on how to do that, see Using the CLI Editor in Configuration
Mode in the CLI User Guide.
NOTE: The source address number in the match rule must be an address
number equal to the source pool range. For example, ^2(32 – 30) =
2^(128 – 126) =>.
Results From configuration mode, confirm your configuration by entering the show security nat
command. If the output does not display the intended configuration, repeat the
configuration instructions in this example to correct it.
source {
pool myipv6_prefix {
address {
2001:db8::/64;
}
}
rule-set myipv6_rs {
from interface ge-0/0/1.0;;
to interface ge-0/0/2.0;
rule ipv6_rule {
match {
source-address 10.1.1.0/30;
destination-address 2001:db8:1a:1112::20/64;
}
then {
source-nat {
pool {
myipv6_prefix;
}
}
}
}
}
}
static {
rule-set test_rs {
from interface ge-0/0/1.0;
rule test_rule {
match {
destination-address 10.1.1.45/30;
}
then {
static-nat {
prefix {
2001:db8::/64;
}
}
}
}
}
}
If you are done configuring the device, enter commit from configuration mode.
Verification
Purpose Verify whether static NAT is configured with an interface, a destination address, and a
prefix.
Action From operational mode, enter the show security nat static command.
Action From operational mode, enter the show security nat source command.
Requirements
Before you begin, configure the interfaces and assign the interfaces to security zones.
Overview
The following example describes how to configure an IPv4 node to communicate with
an IPv6 node using one-to-one static NAT on the device.
The communication of an IPv4 node with an IPv6 node is useful for IPv4 hosts accessing
an IPv6 server, for new servers that support IPv6 only and that need to be connected to
the IPv6 network, and for migrating of old hosts to the new server when most of the
machines have already moved to IPv6. For example, you can use this feature to connect
an IPv4-only node to an IPv6-only printer. This mapping can also be used for DNS ALG
for reverse lookup of IPv4 addresses from IPv6 addresses for traffic that is initiated from
the IPv6 network.
In this example, the source IPv4 address matching the prefix 10.10.10.1/30 is added with
the IPv6 prefix 2001:db8::/96 to form the translated source IPv6 address and the
destination IPv4 address 10.1.1.25/32 is translated to IPv6 address 2001:db8::25/128.
Configuration
CLI Quick To quickly configure this example, copy the following commands, paste them into a text
Configuration file, remove any line breaks, change any details necessary to match your network
configuration, copy and paste the commands into the CLI at the [edit] hierarchy level,
and then enter commit from configuration mode.
Step-by-Step The following example requires you to navigate various levels in the configuration
Procedure hierarchy. For instructions on how to do that, see Using the CLI Editor in Configuration
Mode.
[edit security]
user@host# set nat source pool myipv6_prefix address 2001:db8::/96
Results From configuration mode, confirm your configuration by entering the show security nat
command. If the output does not display the intended configuration, repeat the
configuration instructions in this example to correct it.
[edit]
user@host# show security nat
source {
pool myipv6_prefix {
address {
2001:db8::/96;
}
}
rule-set myipv6_rs {
from interface ge-0/0/1.0;
to interface ge-0/0/2.0;
rule ipv6_rule {
match {
source-address 10.10.10.1/30;
destination-address 2001:db8::25;
}
then {
source-nat {
pool {
myipv6_prefix;
}
}
}
}
}
}
static {
rule-set test_rs {
from interface ge-0/0/1.0;
rule test_rule {
match {
destination-address 10.1.1.25/32;
}
then {
static-nat prefix 2001:db8::25/128;
}
}
}
}
If you are done configuring the device, enter commit from configuration mode.
Verification
Purpose Verify whether static NAT is configured with an interface, a destination address, and a
prefix.
Action From operational mode, enter the show security nat static command.
Action From operational mode, enter the show security nat source command.
Requirements
Before you begin, configure the interfaces and assign the interfaces to security zones.
Overview
The following example describes the communication of an IPv6 node with an IPv4 node
that has prefix-based static NAT defined on the device. The static NAT assumes that
the IPv4 network is a special IPv6 network (that is, an IPv4-mapped IPv6 network), and
hides the entire IPv4 network behind an IPv6 prefix.
The communication of an IPv6 node with an IPv4 node is useful when IPv6 is used in the
network and must be connected to the IPv4 network, or when both IPv4 and IPv6 are
used in the network and a mechanism is required to interconnect the two networks during
migration. This also provides connectivity for sessions initiated from IPv6 nodes with
IPv4 nodes on the other side of the NAT/PT device.
Configuration
CLI Quick To quickly configure this example, copy the following commands, paste them into a text
Configuration file, remove any line breaks, change any details necessary to match your network
configuration, copy and paste the commands into the CLI at the [edit] hierarchy level,
and then enter commit from configuration mode.
Step-by-Step The following example requires you to navigate various levels in the configuration
Procedure hierarchy. For instructions on how to do that, see Using the CLI Editor in Configuration
Mode.
2. Define the rule and destination address with the prefix for the static NAT translation
defined on the device.
7. Define the source address with the prefix for the source NAT defined on the device.
Results From configuration mode, confirm your configuration by entering the show security nat
command. If the output does not display the intended configuration, repeat the
configuration instructions in this example to correct it.
[edit]
user@host# show security nat
source {
pool myipv4 {
address {
203.0.113.2/32 to 203.0.113.5/32;
}
}
rule-set myipv4_rs {
from interface ge-0/0/1.0;
to interface ge-0/0/2.0;
rule ipv4_rule {
match {
source-address 2001:db8::/96;
destination-address 10.1.1.15/30;
}
then {
source-nat {
pool {
myipv4;
}
}
}
}
}
}
static {
rule-set test_rs {
from interface ge-0/0/1.0;
rule test_rule {
match {
destination-address 2001:db8::1/96;
}
then {
static-nat inet;
}
}
}
}
If you are done configuring the device, enter commit from configuration mode.
Verification
Purpose Verify whether static NAT is configured with an interface, a destination address, and a
prefix.
Action From operational mode, enter the show security nat static rule command.
Action From operational mode, enter the show security nat source rule command.
From operational mode, enter the show security nat source pool command.
Requirements
Before you begin, configure the interfaces and assign the interfaces to security zones.
Overview
The following example describes the communication of an IPv6 node with an IPv4 node
that has a one-to-one static NAT address defined on the device. The communication of
an IPv6 node with an IPv4 node allows IPv6 hosts to access an IPv4 server when neither
of the devices has a dual stack and must depend on the NAT/PT device to communicate.
This enables some IPv4 legacy server applications to work even after the network has
migrated to IPv6.
Configuration
CLI Quick To quickly configure this example, copy the following commands, paste them into a text
Configuration file, remove any line breaks, change any details necessary to match your network
configuration, copy and paste the commands into the CLI at the [edit] hierarchy level,
and then enter commit from configuration mode.
Step-by-Step The following example requires you to navigate various levels in the configuration
Procedure hierarchy. For instructions on how to do that, see Using the CLI Editor in Configuration
Mode.
Results From configuration mode, confirm your configuration by entering the show security nat
command. If the output does not display the intended configuration, repeat the
configuration instructions in this example to correct it.
[edit]
user@host# show security nat
source {
pool myipv4 {
address {
203.0.113.2/32 to 203.0.113.3/32;
}
}
rule-set myipv4_rs {
from interface ge-0/0/1.0;
to interface ge-0/0/2.0;
rule ipv4_rule {
match {
source-address 2001:db8::/96;
destination-address 10.2.2.15/32;
}
then {
source-nat {
pool {
myipv4;
}
}
}
}
}
}
static {
rule-set test_rs {
from interface ge-0/0/1.0;
rule test_rule {
match {
destination-address 2001:db8::15/128;
}
then {
static-nat prefix 10.2.2.15/32;
}
}
}
}
If you are done configuring the device, enter commit from configuration mode.
Verification
Purpose Verify whether static NAT is configured with an interface, a destination address, and a
prefix.
Action From operational mode, enter the show security nat static command.
Action From operational mode, enter the show security nat source command.
IPv6 Dual-Stack Lite (DS-Lite) is a technology to help Internet service providers to migrate
to an IPv6 access network without changing end-user software. IPv4 users continue to
access IPv4 internet content with minimum disruption to their home networks while
enabling IPv6 users to access IPv6 content.
IPv4 addresses are becoming depleted; therefore, broadband service providers (DSL,
cable, and mobile) need new addresses to support new users. Providing IPv6 addresses
alone is often not workable because most of the systems that make up the public Internet
are still enabled and support only IPv4, and many users’ systems do not yet fully support
IPv6.
DS-Lite allows service providers to migrate to an IPv6 access network without changing
end-user software. The device that accesses the Internet remains the same, thus allowing
IPv4 users to continue accessing IPv4 internet content with minimum disruption to their
home networks, while enabling IPv6 users to access IPv6 content.
Figure 20 on page 210 illustrates the DS-Lite architecture which uses IPv6-only links
between the provider and the user while maintaining the IPv4 (or dual-stack) hosts in
the user network.
192.0.2.1
192.0.2.1
198.51.100.1
198.51.100.1
2001:db8::2
2001:db8::2
2001:db8::1
192.0.2.1
2001:db8::1
192.0.2.1
g034200
• Softwire initiator for the DS-Lite home router--Encapsulates the IPv4 packet and
transmits it across an IPv6 tunnel.
The softwires terminate in a softwire concentrator at some point in the service provider
network, which decapsulates the IPv4 packets and sends them through a carrier-grade
Network Address Translation (NAT) device. There, the packets undergo source NAT
processing to hide the original source address.
IPv6 packets originated by hosts in the subscriber’s home network are transported natively
over the access network.
The IPv4 packets originated by the end hosts have private (and possibly overlapping) IP
addresses. Therefore, NAT must be applied to these packets. If end hosts have overlapping
addresses, Network Address Port Translation (NAPT) is needed.
Using NAPT, the system adds the source address of the encapsulating IPv6 packet in
the subscriber network to the inside IPv4 source address and port. Because each user’s
IPv6 address is unique, the combination of the IPv6 source address with the IPv4 source
address and port creates an unambiguous mapping.
The system takes the following actions when it receives a responding IPv4 packet from
outside the subscriber network:
• Encapsulates the IPv4 packet in an IPv6 packet using the mapped IPv6 address as the
IPv6 destination address.
Table 14 on page 211 lists the maximum number of softwire initiators and softwire
concentrators per device. Platform support depends on the Junos OS release in your
installation.
Maximum softwire 32 32 32 32 32 32
concentrator numbers per
device
NOTE: The most recent IETF draft documentation for DS-Lite uses new
terminology:
• RFC 2663, IP Network Address Translator (NAT) Terminology and Considerations, August
1999.
• RFC 4787, Network Address Translation (NAT) Behavioral Requirements for Unicast
UDP, BCP 127, January 2007.
• RFC 5382, NAT Behavioral Requirements for TCP, BCP 142, October 2008.
• RFC 5508, NAT Behavioral Requirements for ICMP, BCP 148, April 2009.
• http://www.potaroo.net/tools/ipv4/index.html
• http://www.iana.org/assignments/ipv4-address-space/ipv4-address-space.xhtml
This example shows you how to configure a softwire concentrator for IPv4-in-IPv6
addresses.
Requirements
• Review the overview section on DS-Lite. See “Understanding IPv6 Dual-Stack Lite” on
page 209.
• Review how ICMPv6 packets are handled by the SRX Series devices. See Understanding
How SRX Series Devices Handle ICMPv6 Packets.
Overview
This configuration example shows how to configure a softwire concentrator, the softwire
name, the concentrator address, and the softwire type.
NOTE: The softwire concentrator IPv6 address can match an IPv6 address
configured on a physical interface or an IPv6 address configured on a loopback
interface.
Configuration
CLI Quick To quickly configure this example, copy the following commands, paste them into a text
Configuration file, remove any line breaks, change any details necessary to match your network
configuration, and then copy and paste the commands into the CLI at the [edit] hierarchy
level, and then enter commit from configuration mode.
Step-by-Step The following example requires you to navigate various levels in the configuration
Procedure hierarchy. For instructions on how to do that, see Using the CLI Editor in Configuration
Mode in theCLI User Guide.
To configure a DS-Lite softwire concentrator to convert IPv4 packets into IPv6 packets:
[edit security]
user@host# edit softwires softwire-name my_sc1
Results From configuration mode, confirm your configuration by entering the show command. If
the output does not display the intended configuration, repeat the instructions in this
example to correct the configuration.
If you are done configuring the device, enter commit from configuration mode.
Verification
From operational mode, enter the show security softwires command. If a softwire is not
connected, the operational output looks like the following sample:
If a softwire is connected, the operational output looks like the following sample:
Related • Understanding IPv6 Address Space, Addressing, Address Format, and Address Types
Documentation
• Understanding How SRX Series Devices Handle ICMPv6 Packets
NAT Overview
Network Address Translation (NAT) is a method for modifying or translating network
address information in packet headers. NAT was described in RFC 1631 to solve IPv4
address depletion problems. NAT is a useful tool for firewalls, traffic redirect, load sharing,
and network migrations.
In an SD-WAN deployment, SRX Series devices are deployed in the hub and spoke
locations. Different sites are connected to the spoke SRX Series device. Packets are sent
from these sites to public Internet servers or remote sites. At the hub, after the security
processing is complete, the packet is examined to determine whether the destination is
a public Internet server or an MPLS next-hop device. If the destination is a public Internet
server, NAT converts the virtual routing and forwarding (VRF) private IP address to a
public IP address and establishes a session. Similarly, NAT is required for traffic from
public Internet servers to reach a VRF private network.
• Static NAT
• Destination NAT
• Source NAT
Example: Configuring Source NAT to convert the private IP address of a VRF instance to the
private IP address of another VRF instance
This example describes how to configure a source NAT between two MPLS networks.
Requirements
• Understand how SRX Series devices work in an SD-WAN deployment for NAT. See
“NAT Overview” on page 215.
• Understand Virtual Routing and Forwarding Instances. See Virtual Routing and
Forwarding Instances in SD-WAN Deployments.
Overview
Source NAT is the translation of the source IP address of a packet leaving the Juniper
Networks device. Source NAT is used to allow hosts with private IP addresses to access
a public network.
In this example, the SRX Series device connects two MPLS private networks to convert
the private IP address from one VRF’s private IP address to another VRF’s private IP
address. In Figure 21 on page 216, the spoke SRX Series device is configured with VRF-a
and VRF-b routing instances, which are connected to the hub SRX Series device. Site C
and site D are connected to another spoke SRX Series device. In the hub SRX Series
device, the source IP addresses 192.168.1.200 and 192.168.1.201 from VRF-a and VRF-b
routing instances are translated to 203.0.113.200 and 203.0.113.201.
Site B SRX Series Device VRF-b NAT VRF-b1 SRX Series Device Site D
(Spoke) (Spoke)
SRX Series Device
GRE+MPLS GRE+MPLS
(Hub)
Tunnel Tunnel
g300124
192.168.1.200 203.0.113.200
192.168.1.201 203.0.113.201
Configuration
CLI Quick To quickly configure this example, copy the following commands, paste them into a text
Configuration file, remove any line breaks, change any details necessary to match your network
configuration, copy and paste the commands into the CLI at the [edit] hierarchy level,
and then enter commit from configuration mode.
set security nat source rule-set vrf-a_rs rule rule1 match source-address 192.168.1.200
set security nat source rule-set vrf-a_rs rule rule1 then source-nat pool vrf-a_p
set security nat source pool vrf-b_p address 203.0.113.201
set security nat source rule-set vrf-b_rs from routing-instance VRF-b
set security nat source rule-set vrf-b_rs to routing-instance VRF-b1
set security nat source rule-set vrf-b_rs rule rule2 match source-address 192.168.1.201
set security nat source rule-set vrf-b_rs rule rule2 then source-nat pool vrf-b_p
Step-by-Step The following example requires you to navigate various levels in the configuration
Procedure hierarchy. For information about navigating the CLI, see Using the CLI Editor in Configuration
Mode in the CLI User Guide.
1. Layer 3 VPNs require a VRF table for distributing routes within the networks. Create
a VRF instance and specify the value vrf.
[edit routing-instances]
user@host#set VRF-a instance-type vrf
user@host#set VRF-b instance-type vrf
user@host#set VRF-a1 instance-type vrf
user@host#set VRF-b1 instance-type vrf
[edit routing-instances]
user@host#set VRF-a route-distinguisher 30:200
user@host#set VRF-b route-distinguisher 40:200
user@host#set VRF-a1 route-distinguisher 60:200
user@host#set VRF-b1 route-distinguisher 50:200
[edit routing-instances]
user@host#set VRF-a vrf-target target:100:100
user@host#set VRF-b vrf-target target:200:100
user@host#set VRF-a1 vrf-target target:300:100
user@host#set VRF-b1 vrf-target target:400:100
4. Assign a single VPN label for all the routes in the VRF.
[edit routing-instances]
user@host#set VRF-a vrf-table-label
user@host#set VRF-a1 vrf-table-label
user@host#set VRF-b vrf-table-label
user@host#set VRF-b1 vrf-table-label
7. Configure a rule that matches packets and translates the source IP address to an
IP address in the source NAT pool.
Results From configuration mode, confirm your configuration by entering the show security nat
and show routing-instances commands. If the output does not display the intended
configuration, repeat the configuration instructions in this example to correct it.
[edit]
user@host# show security nat
source {
pool vrf-a_p {
address {
203.0.113.200/32;
}
}
pool vrf-b_p {
address {
203.0.113.201/32;
}
}
rule-set vrf-a_rs {
from routing-instance VRF-a;
to routing-instance VRF-a1;
rule rule1 {
match {
source-address 192.168.1.200/32;
}
then {
source-nat {
pool {
vrf-a_p;
}
}
}
}
}
rule-set vrf-b_rs {
from routing-instance VRF-b;
to routing-instance VRF-b1;
rule rule2 {
match {
source-address 192.168.1.201/32;
}
then {
source-nat {
pool {
vrf-b_p;
}
}
}
}
}
}
[edit]
user@host# show routing-instances
VRF-a {
instance-type vrf;
route-distinguisher 30:200;
vrf-target target:100:100;
vrf-table-label;
}
VRF-a1 {
instance-type vrf;
route-distinguisher 60:200;
vrf-target target:300:100;
vrf-table-label;
}
VRF-b {
instance-type vrf;
route-distinguisher 40:200;
vrf-target target:200:100;
vrf-table-label;
}
VRF-b1 {
instance-type vrf;
route-distinguisher 50:200;
vrf-target target:400:100;
vrf-table-label;
}
If you are done configuring the device, enter commit from configuration mode.
Verification
Purpose Verify that there is traffic matching the source NAT rule.
Action From operational mode, enter the show security nat source rule all command. In the
Translation hits field, verify whether there is traffic that matches the source NAT rule.
Example: Configuring Destination NAT to Convert Public IP Address to VRF’s Single Private IP
Address of a VRF instance
This example describes how to configure the destination NAT mapping of a public IP
address to the single VRF’s private address for directing the packets to the correct VRF
instance.
Requirements
• Understand how SRX Series devices work in an SD-WAN deployment for NAT. See
“NAT Overview” on page 215.
• Understand Virtual Routing and Forwarding Instances. See Virtual Routing and
Forwarding Instances in SD-WAN Deployments.
Overview
Destination NAT is the translation of the destination IP address of a packet entering the
Juniper Networks device. Destination NAT is used to redirect traffic destined to a virtual
host (identified by the original destination IP address) to the real host (identified by the
translated destination IP address).
In this example, an SRX Series device is configured with destination NAT to convert a
public IP address to the VRF private IP address of a VRF instance. The public IP address
can be configured per VRF instance. In Figure 22 on page 221, the SRX Series device is
configured with two VRF instances, VRF-a and VRF-b. The SRX Series device coverts
the public IP address to private IP address of a VRF instance.
Public Public
Address Address
ge-0/0/0 ge-0/0/1
NAT NAT
SRX Series Device
(Hub)
VRF-a VRF-b
GRE+MPLS
Tunnel
Private
Site A Site B
Address
203.0.113.200 192.168.1.200
203.0.113.201 192.168.1.201
Configuration
CLI Quick To quickly configure this example, copy the following commands, paste them into a text
Configuration file, remove any line breaks, change any details necessary to match your network
configuration, copy and paste the commands into the CLI at the [edit] hierarchy level,
and then enter commit from configuration mode.
Step-by-Step The following example requires you to navigate various levels in the configuration
Procedure hierarchy. For information about navigating the CLI, see Using the CLI Editor in Configuration
Mode in the CLI User Guide.
1. Layer 3 VPNs require a VRF table for distributing routes within the networks. Create
a VRF instance and specify the value vrf.
[edit routing-instances]
user@host#set VRF-a instance-type vrf
user@host#set VRF-b instance-type vrf
[edit routing-instances]
user@host#set VRF-a route-distinguisher 30:200
user@host#set VRF-b route-distinguisher 40:200
[edit routing-instances]
user@host#set VRF-a vrf-target target:100:100
user@host#set VRF-b vrf-target target:200:100
4. Assign a single VPN label for all the routes in the VRF.
[edit routing-instances]
user@host#set VRF-a vrf-table-label
user@host#set VRF-b vrf-table-label
8. Configure a rule that matches packets and translates the destination IP address to
an IP address in the destination NAT IP address pool.
Results
From configuration mode, confirm your configuration by entering the show security nat
and show routing-instances commands. If the output does not display the intended
configuration, repeat the configuration instructions in this example to correct it.
[edit]
user@host# show security nat
destination {
pool vrf-a_p {
routing-instance {
VRF-a;
}
address 192.168.1.200/32;
}
pool vrf-b_p {
routing-instance {
VRF-b;
}
address 192.168.1.201/32;
}
rule-set rs {
from interface [ ge-0/0/0.0 ge-0/0/1.0 ];
rule vrf-a_r {
match {
destination-address 203.0.113.200/32;
}
then {
destination-nat {
pool {
vrf-a_p;
}
}
}
}
rule vrf-b_r {
match {
destination-address 203.0.113.201/32;
}
then {
destination-nat {
pool {
vrf-b_p;
}
}
}
}
}
}
[edit]
user@host# show routing-instances
VRF-a {
instance-type vrf;
route-distinguisher 30:200;
vrf-target target:100:100;
vrf-table-label;
}
VRF-b {
instance-type vrf;
route-distinguisher 40:200;
vrf-target target:200:100;
vrf-table-label;
}
If you are done configuring the device, enter commit from configuration mode.
Verification
Purpose Verify that there is traffic matching the destination NAT rule.
Action From operational mode, enter the show security nat destination rule all command. In the
Translation hits field, verify whether there is traffic that matches the destination NAT
rule.
Example: Configuring Static NAT to Convert the Private IP Address of a VRF Instance to Public
IP Address
This example describes how to configure a static NAT mapping of VRF single private IP
address to a public IP address.
Requirements
Understand how SRX Series devices work in an SD-WAN deployment for NAT. See “NAT
Overview” on page 215.
Overview
In this example, an SRX Series device is configured with static NAT to convert the VRF
private IP address of a VRF instance to a public IP address of a VRF instance. Static NAT
can be applied on the source NAT and destination NAT. In Figure 23 on page 226, the SRX
Series device is configured with two VRF instances, VRF-a and VFR-b. The SRX Series
device converts the private IP address of a VRF instance to a public IP address.
Public Public
Address Address
ge-0/0/0 ge-0/0/1
NAT NAT
SRX Series Device
(Hub)
VRF-a VRF-b
GRE+MPLS
Tunnel
Private
Site A Site B
Address
203.0.113.200 192.168.1.200
203.0.113.201 192.168.1.201
Configuration
CLI Quick To quickly configure this example, copy the following commands, paste them into a text
Configuration file, remove any line breaks, change any details necessary to match your network
configuration, copy and paste the commands into the CLI at the [edit] hierarchy level,
and then enter commit from configuration mode.
Step-by-Step The following example requires you to navigate various levels in the configuration
Procedure hierarchy. For information about navigating the CLI, see Using the CLI Editor in Configuration
Mode in the CLI User Guide.
1. Layer 3 VPNs require a VRF table for distributing routes within the networks. Create
a VRF instance and specify the value vrf.
[edit routing-instances]
user@host#set VRF-a instance-type vrf
user@host#set VRF-b instance-type vrf
[edit routing-instances]
user@host#set VRF-a route-distinguisher 30:200
user@host#set VRF-b route-distinguisher 40:200
[edit routing-instances]
user@host#set VRF-a vrf-target target:100:100
user@host#set VRF-b vrf-target target:200:100
4. Assign a single VPN label for all the routes in the VRF.
[edit routing-instances]
user@host#set VRF-a vrf-table-label
user@host#set VRF-b vrf-table-label
6. Configure a rule that matches packets and translates the destination address in
the packets to a private IP address.
Results
From configuration mode, confirm your configuration by entering the show security nat
and show routing-instances commands. If the output does not display the intended
configuration, repeat the configuration instructions in this example to correct it.
[edit]
user@host# show security nat
static {
rule-set rs {
from interface [ ge-0/0/0.0 ge-0/0/1.0 ];
rule vrf-a_r {
match {
destination-address 203.0.113.200/32;
}
then {
static-nat {
prefix {
192.168.1.200/32;
routing-instance VRF-a;
}
}
}
}
rule vrf-b_r {
match {
destination-address 203.0.113.201/32;
}
then {
static-nat {
prefix {
192.168.1.201/32;
routing-instance VRF-b;
}
}
}
}
}
}
[edit]
user@host# show routing-instances
VRF-a {
instance-type vrf;
route-distinguisher 30:200;
vrf-target target:100:100;
vrf-table-label;
}
VRF-b {
instance-type vrf;
route-distinguisher 40:200;
vrf-target target:200:100;
vrf-table-label;
}
If you are done configuring the device, enter commit from configuration mode.
Verification
Purpose Verify that there is traffic matching the static NAT rule.
Action From operational mode, enter the show security nat static rule command. In the Translation
hits field, verify whether there is traffic that matches the static NAT rule.
Related • Flow Management in SRX Series Devices Using VRF Routing Instance
Documentation
• Understanding ALG Support for VRF Routing Instance
Overview
In SD-WAN network, NAT is used when you convert the private IP to global IP pool in a
VRF group. An SRX device can be configured using the following VRF group NAT to
translate the given IPs belonging to a given VRF group to different IPs belonging to
different VRF instances:
Example: Configuring Source NAT to convert the private IP address of a VRF Group to the private
IP address of different VRF instance
This example describes how to configure a source NAT between two MPLS networks.
Requirements
• Understand how SRX Series devices work in an SD-WAN deployment for NAT.
• Understand Virtual-Group in NAT, Virtual Routing and Forwarding Instances. See Virtual
Routing and Forwarding Instances in SD-WAN Deployments.
Overview
Source NAT is the translation of the source IP address of a packet leaving the Juniper
Networks device. Source NAT is used to allow hosts with private IP addresses to access
a public network.
In Figure 24 on page 231, SRX Series device is configured with VRF group vpn-A and vpn-B,
which are connected to the interfaces ge-0/0/1.0 and ge-0/0/1.1 on SRX Series device.
In the hub SRX Series device, the source IP addresses 192.168.1.200 and 192.168.1.201
from VRF group vpn-A and vpn-B are translated to 203.0.113.200 and 203.0.113.201.
Configuration
CLI Quick To quickly configure this example, copy the following commands, paste them into a text
Configuration file, remove any line breaks, change any details necessary to match your network
configuration, copy and paste the commands into the CLI at the [edit] hierarchy level,
and then enter commit from configuration mode.
Step-by-Step The following example requires you to navigate various levels in the configuration
Procedure hierarchy. For information about navigating the CLI, see Using the CLI Editor in Configuration
Mode in the CLI User Guide.
1. In Layer 3 VPNs create a VRF group vpn-A with VRF instances A1 and A2.
[edit security]
user@host#set l3vpn vrf-group vpn-A vrf VRF-A1
user@host#set l3vpn vrf-group vpn-A vrf VRF-A2
2. Create another VRF group vpn-B with VRF instances B1 and B2.
[edit security]
user@host#set l3vpn vrf-group vpn-B vrf VRF-B1
user@host#set l3vpn vrf-group vpn-B vrf VRF-B2
5. Configure a rule that matches packets and translates the source IP address to an
IP address in the source NAT pool.
Results From configuration mode, confirm your configuration by entering the show security nat
command. If the output does not display the intended configuration, repeat the
configuration instructions in this example to correct it.
[edit]
user@host# show security nat
source {
pool vrf-a_p {
address {
203.0.113.200/32;
}
}
pool vrf-b_p {
address {
203.0.113.201/32;
}
}
rule-set vrf-a_rs {
from routing-group vpn-A;
to interface ge-0/0/1.0;
rule rule1 {
match {
source-address 192.168.1.200/32;
}
then {
source-nat {
pool {
vrf-a_p;
}
}
}
}
}
rule-set vrf-b_rs {
from routing-group vpn-B;
to interface ge-0/0/1.1;
rule rule2 {
match {
source-address 192.168.1.201/32;
}
then {
source-nat {
pool {
vrf-b_p;
}
}
}
}
}
}
If you are done configuring the device, enter commit from configuration mode.
Verification
Purpose Verify that there is traffic matching the source NAT rule.
Action From operational mode, enter the show security nat source rule all command. In the
Translation hits field, verify whether there is traffic that matches the source NAT rule.
Example: Configuring Destination NAT to Convert Public IP Address of a VRF Group to the
private IP address of different VRF instance
This example describes how to configure the destination NAT mapping of a public IP
address of a VRF group to the single VRF’s private address for directing the packets to
the correct VRF instance.
Requirements
• Understand how SRX Series devices work in an SD-WAN deployment for NAT.
• Understand Virtual Routing and Forwarding Instances. See Virtual Routing and
Forwarding Instances in SD-WAN Deployments.
Overview
Destination NAT is the translation of the destination IP address of a packet entering the
Juniper Networks device. Destination NAT is used to redirect traffic destined to a virtual
host (identified by the original destination IP address) to the real host (identified by the
translated destination IP address).
In Figure 25 on page 235, the SRX Series device is configured destination NAT to convert
from IP’s that belong to different VRF groups, to different set of IP’s with routing instance
pointing to different VRF. After the destination NAT rule search, NAT updates the
destination routing table to point to right VRF instance for flow to do destination route
look-up in right table.
Configuration
CLI Quick To quickly configure this example, copy the following commands, paste them into a text
Configuration file, remove any line breaks, change any details necessary to match your network
configuration, copy and paste the commands into the CLI at the [edit] hierarchy level,
and then enter commit from configuration mode.
Step-by-Step The following example requires you to navigate various levels in the configuration
Procedure hierarchy. For information about navigating the CLI, see Using the CLI Editor in Configuration
Mode in the CLI User Guide.
1. In Layer 3 VPNs create a VRF group vpn-A with VRF instances A1 and A2.
[edit security]
user@host#set l3vpn vrf-group vpn-A vrf VRF-A1
user@host#set l3vpn vrf-group vpn-A vrf VRF-A2
2. Create another VRF group vpn-B with VRF instances B1 and B2.
[edit security]
user@host#set l3vpn vrf-group vpn-B vrf VRF-B1
user@host#set l3vpn vrf-group vpn-B vrf VRF-B2
6. Configure a rule that matches packets and translates the destination IP address to
an IP address in the destination NAT IP address pool.
Results
From configuration mode, confirm your configuration by entering the show security nat
command. If the output does not display the intended configuration, repeat the
configuration instructions in this example to correct it.
[edit]
user@host# show security nat
destination {
pool vrf-a_p {
routing-instance {
VRF-a;
}
address 192.168.1.200/32;
}
pool vrf-b_p {
routing-instance {
VRF-b;
}
address 192.168.1.201/32;
}
rule-set rs {
from routing-group [ vpn-A vpn-B ];
rule vrf-a_r {
match {
destination-address 203.0.113.200/32;
}
then {
destination-nat {
pool {
vrf-a_p;
}
}
}
}
rule vrf-b_r {
match {
destination-address 203.0.113.201/32;
}
then {
destination-nat {
pool {
vrf-b_p;
}
}
}
}
}
}
If you are done configuring the device, enter commit from configuration mode.
Verification
Purpose Verify that there is traffic matching the destination NAT rule.
Action From operational mode, enter the show security nat destination rule all command. In the
Translation hits field, verify whether there is traffic that matches the destination NAT
rule.
Rule position : 1
From routing-group : vpn-A
Destination addresses : 203.0.113.200 - 203.0.113.200
Action : vrf-a_p
Translation hits : 0
Successful sessions : 0
Failed sessions : 0
Number of sessions : 0
Destination NAT rule: vrf-b_r Rule-set: rs
Rule-Id : 2
Rule position : 2
From routing-group : vpn-A
Destination addresses : 203.0.113.201 - 203.0.113.201
Action : vrf-b_p
Translation hits : 0
Successful sessions : 0
Failed sessions : 0
Number of sessions : 0
Configuration Statements
Description Specify a single address or an address range of the destination NAT pool.
Related
Documentation
address-mapping
Syntax address-mapping;
Hierarchy Level [edit security nat source rule-set ruleset rule rule then source-nat interface persistent-nat]
[edit security nat source rule-set ruleset rule rule then source-nat pool persistent-nat]
Description Allows requests from a specific internal IP address to be mapped to the same reflexive
IP address (the public IP address created by the NAT device closest to the STUN server);
internal and external ports can be any ports. An external host using any port can send a
packet to the internal host by sending the packet to the reflexive IP address (with a
configured incoming policy that allows external to internal traffic). If this option is not
configured, the persistent NAT binding is for specific internal and reflexive transport
addresses.
You can only specify this option when the persistent NAT type is any-remote-host and
the source NAT rule action is one of the following:
Syntax address-persistent;
Description Enable the device to assign the same, statically chosen, IP address from a source pool
to a host for multiple sessions that require the same source IP address for each session.
This option is a global configuration and is applied to all source pools. After a session is
established from a host and NAT is performed, the subsequent session from the same
host will always use the same translated address.
Description Enable the device to translate an IPv6 address, with a consistent IPv6 prefix, to the same
IPv4 address to ensure that IPv4 services can be used over IPv6-only networks.
Related • Understanding NAT64 IPv6 Prefix to IPv4 Address-Persistent Translation on page 154
Documentation
Description The address-pooling paired and address-pooling no-paired options in a source NAT pool
enable you to override the global address-persistent configuration and to control the IP
addressing in the pool. When either address pooling-paired or address-pooling no-paired
is configured in a NAT source pool, the address-persistent configuration is disabled for
that pool.
Use the address-pooling paired option in source NAT pools with port translation for
applications that require all sessions associated with one internal IP address to be
translated to the same external IP address for multiple sessions. (The default behavior
for a source NAT pool with port translation pools is address-pooling no-paired.)
Use the address-pooling no-paired option in source NAT pools without port translation
for assigning IP addresses using a round-robin fashion. (The default behavior for a source
NAT pool without port translation is address-pooling paired.)
Syntax address-shared;
Description Specifies that multiple internal IP addresses can be mapped to the same external IP
address. Use this option only when the source NAT pool is configured with no port
translation.
When a source NAT pool configured with no port translation has few external IP addresses
available, or only one external IP address, the address-shared option, with a many-to-one
mapping, increases NAT resources and improves traffic.
Related • Understanding Shared Addresses in Source NAT Pools without PAT on page 101
Documentation
• Example: Configuring a Single IP Address in a Source NAT Pool Without PAT on page 92
Syntax application {
[application];
any;
}
Hierarchy Level [edit security nat destination rule-set rule-set-name rule rule-name match]
Description Specify an application name to match the rule. You can specify multiple application
names, but the number of application terms must not exceed 3072.
Syntax application {
[application];
any;
}
Hierarchy Level [edit security nat source rule-set rule-set-name rule rule-name match]
Description Specify an application name to match the rule. You can specify multiple application
names, but the number of application terms must not exceed 3072.
Syntax application-services {
enable-gtpu-distribution;
maximize-alg-sessions;
maximize-idp-sessions {
weight (firewall | idp);
}
packet-ordering-mode {
(hardware | software);
}
}
Release Information Statement introduced in Junos OS Release 9.6. Statement updated in Junos OS Release
10.4. Statement updated in Junos OS Release 15.1X49-D40 with the
enable-gtpu-distribution option.
Description You can configure SRX4100, SRX4200, SRX5400, SRX5600, and SRX5800 devices to
switch from an integrated firewall mode to maximize Intrusion Detection and Prevention
(IDP) mode to run IDP processing in tap mode and increase the capacity of processing
with the maximize-idp-sessions option. Inline tap mode can only be configured if the
forwarding process mode is set to maximize-idp-sessions, which ensures stability and
resiliency for firewall services. You also do not need a separate tap or span port to use
inline tap mode. When you maximize IDP, you are decoupling IDP processes from firewall
processes, allowing the device to support the same number of firewall and IDP sessions,
also run the IDP processing in tap mode.
You can configure maximum Application Layer Gateway (ALG) sessions by using the
maximize-alg-sessions option. The session capacity number for Real-Time Streaming
Protocol (RTSP), FTP, and Trivial File Transfer Protocol (TFTP) ALG varies per flow SPU.
For SRX5000 series devices the session capacity is 10,240 per flow SPU. You must reboot
the device (and its peer in chassis cluster mode) for the configuration to take effect. The
maximize-alg-sessions option now enables you to increase defaults as follows:
NOTE: Flow session capacity is reduced to half per flow SPU; therefore
the aforementioned capacity numbers will not change on central point
flow.
15.1X49-D40 onward, the GTP-U distribution is disabled and fat GTP-U sessions are
distributed as normal UDP.
Options The remaining statements are explained separately. See the CLI Explorer.
clear-threshold
Description Configure the lower threshold at which an SNMP trap is triggered when pool utilization
for a source pool without Port Address Translation (PAT) falls below the threshold.
NOTE: The descriptive text should not include characters, such as “<”, “>”,
“&”, or “\n”.
NOTE: The upper limit of the description text range is related to character
encoding, and is therefore dynamic. However, if you configure the descriptive
text length beyond 300 characters, the configuration might fail to take effect.
Related
Documentation
Hierarchy Level [edit security nat destination rule-set rule-set-name rule rule-name]
[edit security nat source rule-set rule-set-name rule rule-name]
[edit security nat static rule-set rule-set-name rule rule-name]
Description Specify descriptive text for a source, destination, or static NAT rule.
NOTE: The descriptive text should not include characters, such as “<”, “>”,
“&”, or “\n”.
NOTE: The upper limit of the description text range is related to character
encoding, and is therefore dynamic. However, if you configure the descriptive
text length beyond 300 characters, the configuration might fail to take effect.
Related
Documentation
Description Specify descriptive text for a source, destination, or static NAT rule set.
NOTE: The descriptive text should not include characters, such as “<”, “>”,
“&”, or “\n”.
Options text—Descriptive text about a source, destination, or static NAT rule set.
Range: 1 through 300 characters
NOTE: The upper limit of the description text range is related to character
encoding, and is therefore dynamic. However, if you configure the descriptive
text length beyond 300 characters, the configuration might fail to take effect.
Related
Documentation
Syntax destination {
pool pool-name {
address <ip-address> {
(port port-number | to ip-address);
}
description text;
routing-instance (routing-instance-name | default);
}
rule-set rule-set-name {
description text;
from {
interface [interface-name];
routing-instance [routing-instance-name];
zone [zone-name];
}
rule rule-name {
description text;
match {
application {
[application];
any;
}
(destination-address ip-address| destination-address-name address-name);
destination-port (port-or-low <to high>);
protocol [protocol-name-or-number];
source-address [ip-address];
source-address-name [address-name];
}
then {
destination-nat (off | pool pool-name |rule-session-count-alarm (clear-threshold
value | raise-threshold value));
}
}
}
}
Release Information Statement modified in Junos OS Release 9.6. The description option added in Junos OS
Release 12.1. Statement modified in Junos OS Release 12.1X45-D10. Statement modified
in Junos OS Release 12.1X47-D10.
Description Configure destination NAT, which allows you to configure the following:
Options The remaining statements are explained separately. See CLI Explorer.
Hierarchy Level [edit security nat destination rule-set rule-set-name rule rule-name match]
Description Specify a destination address to match the rule. You can configure one address or a
subnet.
NOTE:
• If the destination address is IPv4 and the pool is an IPv6 prefix, the length
of the IPv6 prefix must be 96.
• If the destination address is an IPv6 prefix and the pool is an IPv6 prefix,
their length must be the same.
Hierarchy Level [edit security nat source rule-set rule-set-name rule rule-name match]
Description Specify a destination address to match the rule. You can configure multiple addresses
or subnets.
Hierarchy Level [edit security nat static rule-set rule-set-name rule rule-name match]
Description Specify a destination address to match the rule. You can configure one address or a
subnet.
Hierarchy Level [edit security nat destination rule-set rule-set-name rule rule-name match]
Description Specify a destination address name to match the rule. You can configure multiple address
names.
Related
Documentation
Hierarchy Level [edit security nat source rule-set rule-set-name rule rule-name match]
Description Specify a destination address name to match the rule. You can configure multiple address
names.
Related
Documentation
Hierarchy Level [edit security nat static rule-set rule-set-name rule rule-name match]
Related
Documentation
destination-nat
Hierarchy Level [edit security nat destination rule-set rule-set-name rule rule-name then]
Release Information Statement modified in Junos OS Release 9.6. The rule-session-count-alarm option added
in Junos OS Release 12.1X45-D10.
NOTE: If you enter a value for raise-threshold but not for clear-threshold,
clear-threshold is automatically set to 80 percent of raise-threshold.
Hierarchy Level [edit security nat destination rule-set rule-set-name rule rule-name match]
Release Information Statement modified in Junos OS Release 9.6. Statement modified in Junos OS Release
12.1X47-D10.
Description Specify a destination port or port range to match the rule. Up to eight port or port ranges
are supported.
Hierarchy Level [edit security nat source rule-set rule-set-name rule rule-name match]
Release Information Statement modified in Junos OS Release 9.6. Statement modified in Junos OS Release
12.1X47-D10.
Description Specify a destination port or port range to match the rule. Up to eight port or port ranges
are supported.
Related
Documentation
Hierarchy Level [edit security nat static rule-set rule-set-name rule rule-name match]
Description Specify a destination port or port range to allow static NAT to map ports.
Options port-or-low—Specify the port name or the lower limit of the port range.
Related
Documentation
enable-reroute-uniform-link-check
Description Enable retaining an existing session with Network Address Translation (NAT) rule when
there is a change in egress interface because of rerouting.
• If the new egress interface and the previous egress interface are in the same security
zone and there is no change in the matched NAT rule or if no rule is applied before and
after rerouting, the session is retained with the existing NAT rule.
• If the new egress interface and the previous egress interface are in the same security
zone and the matched NAT rule is changed, the session expires.
• If the new egress interface and the previous egress interface are in the same security
zone, the traffic is forwarded to the new egress interface.
Related • Understanding NAT Configuration Check on Egress Interfaces after Reroute on page 103
Documentation
Syntax from {
interface [interface-name];
routing-instance [routing-instance-name];
zone [zone-name];
}
Description Specify the source of the packet among the routing instance, interface, or zone.
host-address-base
Description Specify the base address of the original source IP address range. This is used for IP shifting.
Hierarchy Level [edit security nat source rule-set ruleset rule rule then source-nat interface persistent-nat]
[edit security nat source rule-set ruleset rule rule then source-nat pool persistent-nat]
Description The amount of time, in seconds, that the persistent NAT binding remains in the Juniper
Networks device’s memory when all the sessions of the binding entry are gone. When
the configured timeout is reached, the binding is removed from memory.
Syntax inet {
routing-instance (routing-instance-name| default);
}
Hierarchy Level [edit security nat static rule-set rule-set-name rule rule-name then static-nat]
Description Specify the automatic translation of IPv6 addresses to IPv4 addresses (and vice versa).
NOTE: If you use this option, you do not need to use the prefix option because
with this option, the first 96 most significant bits are automatically stripped
from the 128-bit IPv6 address.
Related
Documentation
Description Specify the interface on which the ARP proxy is to be configured. It should be a logical
interface.
Description Specify the interface on which the NDP proxy is to be configured. It should be a logical
interface.
Related
Documentation
Release Information Statement modified in Junos OS Release 9.6. Statement modified in Junos OS Release
12.1X45-D10.
Options The remaining statements are explained separately. See CLI Explorer.
Related
Documentation
Syntax interface {
persistent-nat {
address-mapping;
inactivity-timeout seconds;
max-session-number value;
permit (any-remote-host | target-host | target-host-port);
}
}
Hierarchy Level [edit security nat source rule-set rule-set-name rule rule-name then source-nat]
Options The remaining statements are explained separately. See CLI Explorer.
interim-logging-interval
Description Specify how often interim system logs are sent for active port blocks and for inactive
port blocks with live sessions. Because system logs are UDP-based, they can be lost in
the network. For this reason, configuring interim logging, which triggers re-sending system
logs, increases reliability. In a chassis cluster configuration, to limit generation of interim
system logs to the primary node only, you must also specify the option log on_primary_node
at the [edit security nat source pool port block-allocation] hierarchy level.
last-block-recycle-timeout
Description Specify the amount of time before the last active port block is released. This option is
used with the active-block-timeout option at [edit security nat source pool port
block-allocation] hierarchy level. When the active-block-timeout option is set to 0 (zero),
port blocks are filled completely before a new port block is allocated. However, the last
port block remains active indefinitely. The last-block-recycle-timeout option allows you
to release the last active block when there are no live sessions remaining. If the
active-block-timeout option is set to anything but 0, the last-block-recycle-timeout option
is not necessary.
Hierarchy Level [edit security nat static rule-set rule-set-name rule rule-name then static-nat prefix]
[edit security nat static rule-set rule-set-name rule rule-name then static-nat prefix-name]
Description Specify a destination port or port range to allow static NAT to map ports.
Related
Documentation
Syntax match {
application {
[application];
any;
}
(destination-address ip-address | destination-address-name address-name);
destination-port (port-or-low <to high>);
protocol [protocol-name-or-number];
source-address [ip-address];
source-address-name [address-name];
}
Hierarchy Level [edit security nat destination rule-set rule-set-name rule rule-name]
Release Information Statement modified in Junos OS Release 9.6. Statement modified in Junos OS Release
12.1X47-D10.
Options The remaining statements are explained separately. See CLI Explorer.
Syntax match {
application {
[application];
any;
}
(destination-address <ip-address> | destination-address-name <address-name>);
destination-port (port-or-low <to high>);
protocol [protocol-name | protocol-number];
source-address [ip-address];
source-address-name [address-name];
source-port (port-or-low <to high>);
}
Hierarchy Level [edit security nat source rule-set rule-set-name rule rule-name]
Release Information Statement modified in Junos OS Release 9.6. Statement modified in Junos OS Release
12.1X45-D10. Statement modified in Junos OS Release 12.1X47-D10.
Options The remaining statements are explained separately. See CLI Explorer.
Syntax match {
(destination-address <ip-address> | destination-address-name <address-name>);
destination-port (port-or-low | <to high>);
source-address [ip-address];
source-address-name [ip-address-name];
source-port (port-or-low <to high>);
}
Hierarchy Level [edit security nat static rule-set rule-set-name rule rule-name]
Release Information Statement modified in Junos OS Release 9.6. Statement modified in Junos OS Release
12.1X45-D10.
Options The remaining statements are explained separately. See CLI Explorer.
max-session-number
Hierarchy Level [edit security nat source rule-set ruleset rule rule then source-nat interface persistent-nat]
[edit security nat source rule-set ruleset rule rule then source-nat pool persistent-nat]
Description The maximum number of the sessions with which a persistent NAT binding can be
associated. For example, if the max-session-number of the persistent NAT rule is 65,536,
then a 65,537th session cannot be established if that session uses the persistent NAT
binding created from the persistent NAT rule.
overflow-pool
Description Specify a source pool to use when the current address pool is exhausted. Currently the
statement is applicable for IPv4 addresses only.
NOTE: The length of the IPv6 prefix must be 96 when the pool is used for
NAT-PT.
NOTE: The source pool must have Port Address Translation (PAT) enabled.
PAT is not supported when the address is an IPv6 prefix address.
nptv6-prefix
Syntax nptv6-prefix {
address-prefix;
routing-instance routing-instance-name;
Hierarchy Level [edit security nat static rule-set rule-set-name rule rule-name then static-nat]
Description Specify a static IPv6 address prefix. The longest prefix supported is /64.
nptv6-prefix-name
Syntax nptv6-prefix-name {
address-prefix-name;
routing-instance routing-instance-name;
Hierarchy Level [edit security nat static rule-set rule-set-name rule rule-name then static-nat]
Description Specify an address prefix name from an address book. The longest prefix name supported
is /64.
• routing-instance —Use the user-defined static NAT routing instance to perform static
NAT.
Hierarchy Level [edit security nat source rule-set ruleset rule rule then source-nat interface persistent-nat]
[edit security nat source rule-set ruleset rule rule then source-nat pool persistent-nat]
Release Information Statement introduced in Junos OS Release 9.6. Support for IPv6 addresses added in
Junos OS Release 11.2.
Options • any-remote-host—All requests from a specific internal IP address and port are mapped
to the same reflexive transport address. (The reflexive transport address is the public
IP address and port created by the NAT device closest to the STUN server.) Any external
host can send a packet to the internal host by sending the packet to the reflexive
transport address.
• target-host—All requests from a specific internal IP address and port are mapped to
the same reflexive transport address. An external host can send a packet to an internal
host by sending the packet to the reflexive transport address. The internal host must
have previously sent a packet to the external host’s IP address.
• target-host-port—All requests from a specific internal IP address and port are mapped
to the same reflexive transport address. An external host can send a packet to an
internal host by sending the packet to the reflexive transport address. The internal host
must have previously sent a packet to the external host’s IP address and port.
persistent-nat
Syntax persistent-nat {
address-mapping;
inactivity-timeout seconds;
max-session-number value;
permit (any-remote-host | target-host | target-host-port);
}
Hierarchy Level [edit security nat source rule-set ruleset rule rule then source-nat interface]
[edit security nat source rule-set ruleset rule rule then source-nat pool]
Release Information Statement introduced in Junos OS Release 9.6. Support for address-mapping added in
Junos OS Release 10.2.
Description Use the persistent-nat feature to ensure that all requests from the same internal transport
address are mapped to the same reflexive transport address (the public IP address and
port created by the NAT device closest to the STUN server). The source NAT rule action
can use a source NAT pool (with or without port translation) or an egress interface.
Options The remaining statements are explained separately. See CLI Explorer.
Release Information Statement modified in Junos OS Release 9.6. The description option added in Junos OS
Release 12.1.
Release Information Statement modified in Junos OS Release 9.6. The description option added in Junos OS
Release 12.1. Statement modified in Junos OS Release 12.1X45-D10. Statement modified
in Junos OS Release 12.3X48-D10.
Hierarchy Level [edit security nat source rule-set rule-set-name rule rule-name then source-nat]
Related
Documentation
pool-default-port-range
Description Set the global default single port range for source NAT pools with port translation. If the
port range in source NAT pools is not specified, the configured default port range is used.
If neither the port range in source NAT pools nor the default port range are configured,
the default single port range is 1024 through 63,487.
To set the global twin port range for source NAT pools with port translation, use the
pool-default-twin-port-range statement at the [edit security nat source] hierarchy. The
twin port range is 63,488 through 65,535.
To set the single port range for a specific pool, use the port range port-low (to port-high)
statement at the [edit security nat source pool] hierarchy level.
Range: 1024 through 63,487. To view pool information, use the show security nat source
pool command.
pool-default-twin-port-range
Description Specify the global default twin port range for all source pools. Two ports within range
(63488, 65535) are allocated at a time for RTP/RTCP applications such as SIP, H.323,
and RTSP for source pools with PAT.
The default twin port range is 2048. If you have an SRX5400, SRX5600, or SRX5800
device that supports a maximum of 1 million IP addresses, use this option to limit the
twin port range and avoid exceeding the port capacity of 384 million.
To set the twin port range for a specific pool, use the port range twin-port port-low (to
port-high) statement at the [edit security nat source pool] hierarchy level.
pool-utilization-alarm
Description Define the global pool utilization alarm thresholds for Network Address Translation (NAT)
source IP address pools without Port Address Translation (PAT). When the pool utilization
exceeds the upper (raise) threshold or falls below the lower (clear) threshold, an SNMP
trap is triggered.
Description Define utilization alarm thresholds for a specific Network Address Translation (NAT)
source pool. When pool utilization exceeds the upper (raise) threshold or falls below the
lower (clear) threshold, an SNMP trap is triggered. Threshold settings that use this
statement take precedence over thresholds that are set using the global
pool-utilization-alarm statement in the [security nat source] hierarchy.
NOTE: If you enter a value for raise-threshold but not for clear-threshold,
clear-threshold is automatically set to 80 percent of raise-threshold.
Syntax port {
block-allocation {
active-block-timeout timeout-interval;
block-size block-size;
interim-logging-interval timeout-interval;
last-block-recycle-timeout timeout-interval;
log disable;
maximum-blocks-per-host maximum-block-number;
}
deterministic {
block-size block-size;
host {
address ip-address;
address-name address-name ;
}
}
no-translation;
port-overloading-factor number;
range {
port-low <to port-high>;
to port-high;
twin-port port-low <to port-high>;
}
}
Release Information Statement introduced in Junos OS Release 9.2. Statement updated with block-allocation,
deterministic, and twin-port options in Junos OS Release 12.1X47-D10. Statement updated
with interim-logging-interval and last-block-recycle-timeout options in Junos OS Release
15.1X49-D60.
Description Specify the Port Address Translation (PAT) for a source pool.
• range port-low <to port-high>—Specifies the port number range attached to each
address in the pool. This option cannot be configured with the no-translation option.
• twin port—Configures the twin port range for source NAT pools to avoid port overloading.
Description Configure the port overloading capacity for the source NAT interface. If
port-overloading-factor is set to x(1 up to the maximum port capacity), then x times the
maximum port capacity is allocated for interface-based NAT.
Options number—A number ranging from 1 through the maximum port capacity.
Syntax port-overloading-factor
Description Configures the port overloading capacity in source NAT. If the port-overloading-factor
is set to x, each translated IP address will have x number of ports available.
For example, If you set port-overloading-factor to 2 for a source pool with two IP addresses,
each with the single port range of 1024 through 2047, the ports are multiplied by 2,
increasing the port capacity for each from 1024 to 2048. If the configured
port-overloading-factor setting exceeds the maximum port capacity of the pool, an
error message is generated during the configuration commit.
Related
Documentation
port-randomization
Description Disable random port allocation for pool-based and interface source NAT.
Options disable—Disables random port allocation for pool-based and interface source NAT. For
pool-based source NAT and interface NAT, port numbers are allocated randomly
by default. Although randomized port number allocation can provide protection from
security threats such as DNS poison attacks, it can also affect performance and
memory usage for pool-based source NAT.
port-round-robin
Description Disable round-robin port allocation for pool-based and interface source NAT on SRX5400,
SRX5600, and SRX5800 devices.
Options disable—Disables round-robin port allocation for pool-based and interface source NAT.
port-scaling-enlargement
Syntax port-scaling-enlargement;
Description Increase the source NAT port capacity on SRX5400, SRX5600, and SRX5800 devices
with next-generation Services Processing Cards (SPCs).
Syntax prefix {
address-prefix;
mapped-port lower-port-range to upper-port-range;
routing-instance (routing-instance-name| default);
}
Hierarchy Level [edit security nat static rule-set rule-set-name rule rule-name then static-nat]
NOTE: If you use the inet option for translation of IPv6 to IPv4 addresses
(and vice versa), you do not need to specify a prefix because the inet option
automatically strips the first 96 most significant bits from the 128-bit IPv6
address.
Related
Documentation
Syntax prefix-name {
address-prefix-name;
mapped-port lower-port-range to upper-port-range;
routing-instance (routing-instance-name| default);
}
Hierarchy Level [edit security nat static rule-set rule-set-name rule rule-name then static-nat]
Related
Documentation
Hierarchy Level [edit security nat destination rule-set rule-set-name rule rule-name match]
Description Specify an IP protocol to match the rule. You can configure multiple protocol names or
protocol numbers.
Related
Documentation
Hierarchy Level [edit security nat source rule-set rule-set-name rule rule-name match]
Description Specify an IP protocol to match the rule. You can configure multiple protocol names or
protocol numbers.
Related
Documentation
Syntax proxy-arp {
interface interface-name {
address ip-address {
to ip-address;
}
}
}
Options The remaining statements are explained separately. See CLI Explorer.
Syntax proxy-ndp {
interface interface-name {
address ip-address {
to ip-address;
}
}
}
Options The remaining statements are explained separately. See CLI Explorer.
Related
Documentation
raise-threshold
Description Configure the upper threshold at which an SNMP trap is triggered when pool utilization
for a source pool without Port Address Translation (PAT) rises above the threshold. This
feature is disabled by default.
Description Specify the routing instance on which to perform the route lookup for the address in the
pool. It is not a mandatory flag.
A destination NAT pool that does not specify a specific routing instance will default to
the routing instance of the ingress zone. You can configure a NAT pool to exist in the
default routing instance. As a result, the NAT pool is reachable from zones in the default
routing instance and from zones in other routing instances.
Description Specify the routing instance to which the pool is bound. It is not a mandatory flag. If the
user does not configure the routing instance, by default the pool belongs to
routing-instance inet.0.
Related
Documentation
Release Information Statement introduced in Junos OS Release 9.2. The description option added in Junos
OS Release 12.1. Statement modified in Junos OS Release 12.1X45-D10. Statement
modified in Junos OS Release 12.1X47-D10.
Release Information Statement modified in Junos OS Release 9.6. The description option added in Junos OS
Release 12.1. Statement modified in Junos OS Release 12.1X45-D10. Statement modified
in Junos OS Release 12.1X47-D10.
Release Information Statement introduced in Junos OS Release 9.3. The description option added in Junos
OS Release 12.1. Statement modified in Junos OS Release 12.1X45-D10. Statement
modified in Junos OS Release 12.3X48-D25.
Related
Documentation
Hierarchy Level [edit security nat destination rule-set rule-set-name rule rule-name then destination-nat ]
Description Define session count alarm thresholds for a specific Network Address Translation (NAT)
destination rule. When the session count exceeds the upper (raise) threshold or falls
below the lower (clear) threshold, an SNMP trap is triggered.
NOTE: If you enter a value for raise-threshold but not for clear-threshold,
clear-threshold is automatically set to 80 percent of raise-threshold.
Related
Documentation
Hierarchy Level [edit security nat source rule-set rule-set-name rule rule-name then source-nat ]
Description Define session count alarm thresholds for a specific Network Address Translation (NAT)
source rule. When the session count exceeds the upper (raise) threshold or falls below
the lower (clear) threshold, an SNMP trap is triggered.
NOTE: If you enter a value for raise-threshold but not for clear-threshold,
clear-threshold is automatically set to 80 percent of raise-threshold.
Related
Documentation
Hierarchy Level [edit security nat static rule-set rule-set-name rule rule-name then static-nat ]
Description Define session count alarm thresholds for a specific static Network Address Translation
(NAT) rule. When the session count exceeds the upper (raise) threshold or falls below
the lower (clear) threshold, an SNMP trap is triggered.
NOTE: If you enter a value for raise-threshold but not for clear-threshold,
clear-threshold is automatically set to 80 percent of raise-threshold.
Related
Documentation
Release Information Statement modified in Junos OS Release 9.6. The description option added in Junos OS
Release 12.1. Statement modified in Junos OS Release 12.1X45-D10. Statement modified
in Junos OS Release 12.1X47-D10.
Related
Documentation
Release Information Statement modified in Junos OS Release 9.6. The description option added in Junos OS
Release 12.1. Statement modified in Junos OS Release 12.1X45-D10. Statement modified
in Junos OS Release 12.1X47-D10.
NOTE: When zones are not configured under rule-set and when active source
NAT is configured with missing mandatory statement “from” then, the
following message is displayed when performing commit “Missing mandatory
statement: 'from' error: configuration check-out failed” and the configuration
check-out fails.
Related
Documentation
Release Information Statement modified in Junos OS Release 9.6. The description option added in Junos OS
Release 12.1. The rule-session-count-alarm, source-address, source-address-name, and
source-port options added in Junos OS Release 12.1X45-D10.
Related
Documentation
Syntax source {
address-persistent;
interface (port-overloading off | port-overloading-factor number);
pool pool-name {
address ip-address {
to ip-address;
}
address-persistent subscriber ipv6-prefix-length prefix-length;
address-pooling (paired | no-paired);
address-shared;
description text;
host-address-base ip-address;
overflow-pool (interface | pool-name);
pool-utilization-alarm (clear-threshold value | raise-threshold value);
port {
block-allocation {
active-block-timeout timeout-interval;
block-size block-size;
interim-logging-interval timeout-interval;
last-block-recycle-timeout timeout-interval;
log disable;
maximum-blocks-per-host maximum-block-number
}
deterministic {
block-size block-size;
host {
address ip-address;
address-name address-name;
}
no-translation;
port-overloading-factor number;
range {
port-low <to port-high>;
to port-high;
twin-port port-low <to port-high>;
}
}
routing-instance routing-instance-name;
}
pool-default-port-range lower-port-range to upper-port-range;
pool-default-twin-port-range lower-port-range to upper-port-range;
pool-utilization-alarm (clear-threshold value | raise-threshold value);
port-randomization disable;
port-round-robin disable;
port-scaling-enlargement;
rule-set rule-set-name {
description text;
from {
interface [interface-name];
routing-instance [routing-instance-name];
zone [zone-name];
}
rule rule-name {
description text;
match {
application {
[application];
any;
}
(destination-address <ip-address> | destination-address-name <address-name>);
destination-port (port-or-low <to high>);
protocol [protocol-name-or-number];
source-address [ip-address];
source-address-name [address-name];
source-port (port-or-low <to high>)
}
then source-nat
interface {
persistent-nat {
address-mapping;
inactivity-timeout seconds;
max-session-number value;
permit (any-remote-host | target-host | target-host-port);
}
}
off;
pool <pool-name>
persistent-nat {
address-mapping;
inactivity-timeout seconds;
max-session-number number;
permit (any-remote-host | target-host | target-host-port);
}
rule-session-count-alarm (clear-threshold value | raise-threshold value);
}
}
}
to {
interface [interface-name];
routing-instance [routing-instance-name];
zone [zone-name];
}
}
}
Release Information Statement modified in Junos OS Release 9.6. The description option added in Junos OS
Release 12.1. Statement modified in Junos OS Release 12.1X45-D10. Statement modified
in Junos OS Release 12.1X47-D10. Statement modified in Junos OS Release 12.3X48-D10.
Statement modified in Junos OS Release 15.1X49-D60.
Description Configure source NAT, which allows you to configure the following:
Options The remaining statements are explained separately. See CLI Explorer.
session-drop-hold-down
Description Specify the session hold time value to hold the NAT source session without expiring. The
session hold time value must be 30 seconds through 28,800 seconds (eight hours).
session-persistence-scan
Syntax session-persistence-scan;
Description Specify the sessions to be retained if there is a change in NAT configuration. The existing
sessions are retained, if the new session and existing sessions are in the same security
zone.
Hierarchy Level [edit security nat destination rule-set rule-set-name rule rule-name match]
Description Specify source address to match the rule. You can configure multiple addresses or
subnets.
Hierarchy Level [edit security nat source rule-set rule-set-name rule rule-name match]
Description Specify source address to match the rule. You can configure multiple addresses or
subnets.
Hierarchy Level [edit security nat static rule-set rule-set-name rule rule-name match]
Description Specify the source address to match the rule. Up to 8 addresses are supported.
Related
Documentation
Hierarchy Level [edit security nat destination rule-set rule-set-name rule rule-name match]
Description Specify a source address name to match the rule. You can configure multiple address
names.
Related
Documentation
Hierarchy Level [edit security nat source rule-set rule-set-name rule rule-name match]
Description Specify a source address name to match the rule. You can configure multiple address
names.
Related
Documentation
Hierarchy Level [edit security nat static rule-set rule-set-name rule rule-name match]
Description Specify a source address name to match the rule. Up to 8 address names are supported.
Related
Documentation
source-nat
Syntax source-nat {
interface {
persistent-nat {
address-mapping;
inactivity-timeout seconds;
max-session-number value;
permit (any-remote-host | target-host | target-host-port);
}
}
off;
pool <pool-name>;
persistent-nat {
address-mapping;
inactivity-timeout seconds;
max-session-number number;
permit (any-remote-host | target-host | target-host-port);
}
rule-session-count-alarm (clear-threshold value | raise-threshold value);
}
Hierarchy Level [edit security nat source rule-set rule-set-name rule rule-name then]
Release Information Statement modified in Junos OS Release 9.6. Statement modified in Junos OS Release
12.1X45-D10.
Hierarchy Level [edit security nat source rule-set rule-set-name rule rule-name match]
Description Specify the port number or port range for a source rule. Up to 8 ports or port ranges are
supported.
Hierarchy Level [edit security nat static rule-set rule-set-name rule rule-name match]
Description Specify the port or port range for a source rule. Up to 8 ports or port ranges are supported.
Related
Documentation
Syntax static {
rule-set rule-set-name {
description text;
from {
interface [interface-name];
routing-instance [routing-instance-name];
zone [zone-name];
}
rule rule-name {
description text;
match {
(destination-address <ip-address> | destination-address-name <address-name>);
destination-port (port-or-low | <to high>);
source-address [ip-address];
source-address-name [ip-address-name];
source-port (port-or-low <to high>);
}
then {
static-nat {
inet {
routing-instance (routing-instance-name| default);
}
nptv6-prefix {
address-prefix;
routing-instance routing-instance-name;
nptv6-prefix-name {
address-prefix-name;
routing-instance routing-instance-name;
[
prefix {
address-prefix;
mapped-port lower-port-range to upper-port-range;
routing-instance (routing-instance-name| default);
}
prefix {
address-prefix-name;
mapped-port lower-port-range to upper-port-range;
routing-instance (routing-instance-name| default);
}
rule-session-count-alarm (clear-threshold value | raise-threshold value);
}
}
}
}
}
Release Information Statement introduced in Junos OS Release 9.3. The description option added in Junos
OS Release 12.1. Statement modified in Junos OS Release 12.1X45-D10. Statement
modified in Junos OS Release 12.3X48-D25.
Options The remaining statements are explained separately. See CLI Explorer.
static-nat
Syntax static-nat {
inet {
routing-instance (default | routing-instance-name);
}
nptv6-prefix {
address-prefix;
routing-instance routing-instance-name;
nptv6-prefix-name {
address-prefix-name;
routing-instance routing-instance-name;
[
prefix {
address-prefix;
routing-instance (default | routing-instance-name);
}
prefix-name {
address-prefix-name;
routing-instance (default | routing-instance-name);
}
rule-session-count-alarm (clear threshold value | raise threshold value);
}
Hierarchy Level [edit security nat static rule-set rule-set-name rule rule-name then]
Release Information Statement modified in Junos OS Release 9.6. Statement modified in Junos OS Release
12.1X45-D10. Statement modified in Junos OS Release 12.3X48-D25.
Options The remaining statements are explained separately. See CLI Explorer.
Syntax to {
interface [interface-name];
routing-instance [routing-instance-name];
zone [zone-name];
}
Description Specify the destination of the packet among the routing instance, interface, or zone.
Related
Documentation
Syntax then {
destination-nat (off | pool pool-name | rule-session-count-alarm (clear-threshold value |
raise-threshold value));
}
Hierarchy Level [edit security nat destination rule-set rule-set-name rule rule-name]
Release Information Statement modified in Junos OS Release 9.6. Statement modified in Junos OS Release
12.1X45-D10.
Description Specify the action to be performed when traffic matches the destination NAT rule criteria.
Options The remaining statements are explained separately. See CLI Explorer.
Hierarchy Level [edit security nat source rule-set rule-set-name rule rule-name]
Release Information Statement modified in Junos OS Release 9.6. Statement modified in Junos OS Release
12.1X45-D10.
Description Specify the action to be performed when traffic matches the source NAT rule criteria.
Options The remaining statements are explained separately. See CLI Explorer.
Syntax then {
static-nat {
inet {
routing-instance (default | routing-instance-name);
}
nptv6-prefix {
address-prefix;
routing-instance routing-instance-name;
nptv6-prefix-name {
address-prefix-name;
routing-instance routing-instance-name;
[
prefix {
address-prefix;
mapped-port lower-port-range to upper-port-range;
routing-instance (default | routing-instance-name);
}
prefix-name {
address-prefix-name;
mapped-port lower-port-range to upper-port-range;
routing-instance (default | routing-instance-name);
}
rule-session-count-alarm (clear-threshold value | raise-threshold value);
}
Hierarchy Level [edit security nat static rule-set rule-set-name rule rule-name]
Release Information Statement modified in Junos OS Release 9.6. Statement modified in Junos OS Release
12.1X45-D10. Statement modified in Junos OS Release 12.3X48-D25.
Description Specify the action to be performed when traffic matches the static NAT rule criteria.
Options The remaining statements are explained separately. See CLI Explorer.
Related
Documentation
Syntax traceoptions {
file {
filename;
files number;
match regular-expression;
size maximum-file-size;
(world-readable | no-world-readable);
}
flag flag;
no-remote-trace;
}
• filename—Name of the file to receive the output of the tracing operation. Enclose
the name within quotation marks. All files are placed in the directory /var/log. By
default, the name of the file is the name of the process being traced.
• files number—Maximum number of trace files. When a trace file named trace-file
reaches its maximum size, it is renamed to trace-file.0, then trace-file.1, and so on,
until the maximum number of trace files is reached. The oldest archived file is
overwritten.
If you specify a maximum number of files, you also must specify a maximum file size
with the size option and a filename.
Default: 10 files
• match regular-expression—Refine the output to include lines that contain the regular
expression.
If you specify a maximum file size, you also must specify a maximum number of trace
files with the files option and a filename.
Range: 10 KB through 1 GB
Default: 128 KB
• flag—Trace operation to perform. To specify more than one trace operation, include
multiple flag statements.
Related
Documentation
Operational Commands
Release Information Command introduced in Junos OS Release 8.5. The node options added in Junos OS
Release 9.0.
Description Clear Network Address Translation (NAT) persistent NAT bindings that are in query
mode, where all sessions of the binding are gone.
Options • all—Clear all persistent NAT bindings that are in query mode.
• interface—Clear persistent NAT bindings that are in query mode for the specified
interface.
• internal-ip ip-address—Clear persistent NAT bindings for the specified internal IP address.
• internal-ip ip-address internal-port port—Clear persistent NAT bindings that are in query
mode for the specified internal IP address and port.
• pool—Clear persistent NAT bindings that are in query mode for the specified source
NAT pool.
Output Fields When you enter this command, you are provided feedback on the status of your request.
Output Fields When you enter this command, you are provided feedback on the status of your request.
Output Fields When you enter this command, you are provided feedback on the status of your request.
Output Fields When you enter this command, you are provided feedback on the status of your request.
Output Fields When you enter this command, you are provided feedback on the status of your request.
Description Display information about the specified Network Address Translation (NAT) destination
address pool.
root-logical-system—Display information about the destination NAT pools for the master
(root) logical system.
List of Sample Output show security nat destination pool dst-nat-pool1 on page 340
show security nat destination pool all on page 340
show security nat destination pool all tenant on page 341
Output Fields Table 15 on page 340 lists the output fields for the show security nat destination pool
command. Output fields are listed in the approximate order in which they appear.
Sample Output
Sample Output
Total address : 1
Translation hits: 0
Address range Port
2001:db8::1 - 2001:db8::1 0
Release Information Command introduced in Junos OS Release 9.2. The Description output field added in
Junos OS Release 12.1.
Support for IPv6 logical systems and the Successful sessions, Failed sessions and Number
of sessions output fields added in Junos OS Release 12.1X45-D10.
Output for multiple destination ports and the application option field added in Junos OS
Release 12.1X47-D10.
The tenant option is introduced in Junos OS Release 18.3R1.
Description Display information about the specified destination Network Address Translation (NAT)
rule. Destination NAT rules are processed after static NAT rules but before source NAT
rules.
logical-system —Display information about the destination NAT rules for a specified
logical system. Specify all to display information for all logical systems.
root-logical-system—Display information about the destination NAT rules for the master
(root) logical system.
tenant—Display information about the destination NAT rules for a specified tenant
system. Specify all to display information for all tenant systems.
List of Sample Output show security nat destination rule dst2-rule on page 343
show security nat destination rule all on page 344
show security nat destination rule all tenant on page 344
Output Fields Table 16 on page 343 lists the output fields for the show security nat destination rule
command. Output fields are listed in the approximate order in which they appear.
Total referenced IPv4/IPv6 Number of IP prefixes referenced in source, destination, and static NAT rules. This total
ip-prefixes includes the IP prefixes configured directly as address names and as address set names
in the rule.
From routing instance Name of the routing instance from which the packets flow.
From interface Name of the interface from which the packets flow.
From zone Name of the zone from which the packets flow.
Source addresses Name of the source addresses that match the rule. The default value is any.
Destination addresses Name of the destination addresses that match the rule. The default value is any.
Action The action taken when a packet matches the rule’s tuples. Actions include the following:
Destination ports Destination ports number that match the rule. The default value is any.
Successful sessions Number of successful session installations after the NAT rule is matched.
Failed sessions Number of unsuccessful session installations after the NAT rule is matched.
Sample Output
Destination port : 0
Translation hits : 68
Successful sessions : 25
Failed sessions : 43
Number of sessions : 2
Sample Output
Description Display information about the specified destination Network Address Translation (NAT)
rule application.
Options rule-name—Display information about the specified destination NAT rule application.
Related • Logical Systems and Tenant Systems Feature Guide for Security Devices
Documentation
List of Sample Output show security nat destination rule-application for port application on page 347
show security nat destination rule-application for ICMP application on page 347
Output Fields Table 17 on page 346 lists the output fields for the show security nat destination
rule-application command. Output fields are listed in the approximate order in which
they appear.
Table 17: show security nat destination rule-application Output Fields (continued)
Sample Output
Sample Output
Description Display a summary of Network Address Translation (NAT) destination pool information.
logical-system —Display summary information about the destination NAT for a specified
logical system. Specify all to display information for all logical systems.
tenant —Display information about the destination NAT for a specified tenant system.
Specify all to display information for all tenant systems.
List of Sample Output show security nat destination summary on page 349
show security nat destination summary tenant on page 349
Output Fields Table 18 on page 348 lists the output fields for the show security nat destination summary
command. Output fields are listed in the approximate order in which they appear.
Table 18: show security nat destination summary Output Fields (continued)
Total hit times Number of times a translation in the translation table is used for all the destination NAT
rules.
Total fail times Number of times a translation in the translation table failed to translate for all the
destination NAT rules.
Sample Output
Total pools: 2
Pool name Address Routing Port Total
Range Instance Address
dst-p1 203.0.113.1 -203.0.113.1 default 0 1
dst-p2 2001:db8::1 - 2001:db8::1 default 0 1
...
Total pools: 1
Pool name Address Routing Port Total
Total rules: 1
Rule name Rule set From Action
r1 from_zone untrust h1
Release Information Command introduced in Junos OS Release 8.5. The node options added in Junos OS
Release 9.0.
NOTE: The incoming dip NAT table is replaced with ALG cone NAT binding
table and the show security nat incoming-table command is obsolete from
Junos OS Release 11.2 onward. The show security nat incoming-table command
works as is in the previous releases.
Output Fields Table 19 on page 351 lists the output fields for the show security nat incoming-table
command. Output fields are listed in the approximate order in which they appear.
Host Host IP address and port number that the destination IP address is mapped.
Sample Output
Release Information Command modified in Junos OS Release 9.2. The node options added in Junos OS Release
9.0. Logical system support added in Junos OS Release 12.1X45-D10.
Description Display port usage for an interface source pool for Network Address Translation (NAT).
Options none—Display all port usage information for an interface source pool.
Output Fields Table 20 on page 353 lists the output fields for the show security nat interface-nat-ports
command. Output fields are listed in the approximate order in which they appear.
Total Ports Total number of ports in a port pool. In SRX Series devices, 10 interface NAT ports are
supported.
Single Ports Allocated Number of ports allocated one at a time that are in use.
Single Ports Available Number of ports allocated one at a time that are free for use.
Twin Ports Allocated Number of ports allocated two at a time that are in use.
Twin Ports Available Number of ports allocated two at a time that are free for use.
Sample Output
Pool Total Single ports Single ports Twin ports Twin ports
index ports allocated available allocated available
0 64510 0 63486 0 1024
1 64510 0 63486 0 1024
2 64510 0 63486 0 1024
3 64510 0 63486 0 1024
4 64510 0 63486 0 1024
5 64510 0 63486 0 1024
6 64510 0 63486 0 1024
7 64510 0 63486 0 1024
8 64510 0 63486 0 1024
9 64510 0 63486 0 1024
Sample Output
Description Display source NAT pool usage information. In pools without Port Address Translation
(PAT), information about IP addresses is displayed. In pools with PAT, information about
ports is displayed.
Options all—Display resource use information for all source NAT pools.
source-pool-name—Display resource use information for the specified source NAT pool.
root-logical-system—Display resource use information for the source NAT pools in the
root logical system.
List of Sample Output show security nat resource-usage resource-pool all on page 357
show security nat resource-usage resource-pool pool-name (Without PAT) on page 358
show security nat resource-usage resource-pool pool-name (with PAT) on page 358
Output Fields Table 21 on page 357 lists the output fields for the show security nat resource-usage
source-pool command. Output fields are listed in the approximate order in which they
appear. You can use the clear security nat statistics command to reset the peak usage
statistics.
Starting in Junos OS Release 15.1X49-D90 and Junos OS Release 17.3R1, the total number
of addresses for pools with IPv6 prefixes is shown as zero (0).
Starting in Junos OS Release 15.1X49-D90 and Junos OS Release 17.3R1, the total number
of available resources for pools with IPv6 prefixes is shown as 0.
Usage Percent of resources used. In a PAT pool, use includes single and twin ports.
Peak usage Percent of resources used during the peak date and time.
Sample Output
192.0.2.113
0 Single Ports 30001 32463 62464 48%
192.0.2.114
0 Single Ports 29600 32864 62464 47%
pool-name—Display Deterministic NAT port block table for the specified source pool
name.
host ip address—Display deterministic NAT port block table based on internal host ip
address.
xlated-port—Display deterministic NAT port block table based on translated IP and port;
xlated-port can be used only with xlated-ip together for display.
root-logical-system—Display information about the source NAT pools for the master
(root) logical system.
List of Sample Output show security nat source deterministic on page 360
Output Fields Table 22 on page 360 lists the output fields for the show security nat source deterministic
command. Output fields are listed in the approximate order in which they appear.
Used/total port blocks Port block used number and port block total number for this source NAT pool.
Sample Output
Description Display information about the Network Address Translation (NAT) source paired
addresses.
root-logical-system—Display information about the source NAT pools for the master
(root) logical system.
Additional Information
Related
Documentation
List of Sample Output show security nat source paired-address on page 362
show security nat source paired-address pool-name on page 362
show security nat source paired-address pool-name internal-ip on page 362
show security nat source paired-address pool-name xlated-ip on page 362
Output Fields Table 23 on page 362 lists the output fields for the show security nat source paired-address
command. Output fields are listed in the approximate order in which they appear.
Sample Output
Syntax show security nat source persistent-nat-table ( all | interface | internal-ip ip-address
<internal-port port> | pool poolname )
Release Information Command introduced in Junos OS Release 9.6. Support for IPv6 addresses added in
Junos OS Release 11.2.
• internal-ip ip-address internal-port port—Display persistent NAT bindings for the specified
internal IP address and port.
• pool—Display persistent NAT bindings for the specified source NAT pool.
List of Sample Output show security nat source persistent–nat–table internal-ip internal-port on page 365
show security nat source persistent–nat–table all on page 365
show security nat source persistent-nat-table summary on page 366
Output Fields Table 24 on page 364 lists the output fields for the show security nat source
persistent–nat–table command. Output fields are listed in the approximate order in which
they appear.
Internal IP/Port Internal transport IP address and port number of the outgoing session from internal to
external.
Reflexive IP/Port Translated IP address and port number of the source IP address and port.
Source NAT Pool The name of the source pool where persistent NAT is used.
Table 24: show security nat source persistent–nat–table Output Fields (continued)
Left_time/Conf_time The inactivity timeout period that remains and the configured timeout value.
Current_Sess_Num/Max_Sess_Num The number of current sessions associated with the persistent NAT binding.
Source NAT Rule Name of the source NAT rule to which this persistent NAT binding applies.
Sample Output
Sample Output
Sample Output
Description Display information about the specified Network Address Translation (NAT) source
address pool and the configured twin port range per pool.
Options pool-name—Display source NAT information for the specified address pool.
logical-system—Display information about the source NAT pools for a specified logical
system. Specify all to display information for all logical system.
root-logical-system—Display information about the source NAT pools for the master
(root) logical system.
tenant—Display information about the source NAT pools for a specified tenant system.
Specify all to display information for all tenant systems.
List of Sample Output show security nat source pool src-p1 on page 369
show security nat source pool all on page 369
show security nat source pool all tenant on page 370
show security nat source pool sp1 on page 371
show security nat source pool P_1 on page 371
show security nat source pool src-nat-v4-with-pat on page 371
show security nat source pool src-nat-pool-1 on page 371
Output Fields Table 25 on page 368 lists the output fields for the show security nat source pool command.
Output fields are listed in the approximate order in which they appear.
Host address base Base address of the original source IP address range.
Starting in Junos OS Release 15.1X49-D90 and Junos OS Release 17.3R1, the total number
of addresses for pools with IPv6 prefixes is shown as zero (0).
Last block recycle timeout Amount of time before the last active block is released.
Interim logging interval Time interval for which additional system log messages are sent for active blocks and
for inactive blocks with existing sessions.
Determ host range num Host range for the deterministic pool.
Table 25: show security nat source pool Output Fields (continued)
Sample Output
Sample Output
Total pools: 4
Pool id : 5
Routing instance : default
Host address base : 0.0.0.0
Port : [1024, 63487]
Address assignment : no-paired
port overloading : 1
Total addresses : 4
Translation hits : 0
Address range Single Ports Twin Ports
192.0.2.0 - 192.0.2.3 0 0
Total pools: 1
Pool name : pat
Pool id : 4
Routing instance : default
Host address base : 0.0.0.0
Port : [1024, 63487]
Twin port : [63488, 65535]
Port overloading : 1
Address assignment : no-paired
Total addresses : 24
Translation hits : 0
Address range Single Ports Twin Ports
192.0.2.1 - 192.0.2.24 0 0
Total used ports : 0 0
Release Information Command introduced in Junos OS Release 12.1X47-D10. The Last active block recycle
timeout output field added in Junos OS Release 15.1X49-D60.
Options pool-name—Display the PBA port block table for the specified source pool.
host ip address—Display the PBA port block table based on the host IP address.
xlated ip address—Display the PBA port block table based on the translated IP address.
xlated-port—Display the PBA port block table based on the translated IP address and
the translated port information.
root-logical-system—Display the PBA port block table for the master (root) logical
system.
List of Sample Output show security nat source port-block on page 374
show security nat source port-block (active block recycle timeout) on page 375
Output Fields Table 26 on page 373 lists the output fields for the show security nat source port-block
command. Output fields are listed in the approximate order in which they appear.
Table 26: show security nat source port-block Output Fields (continued)
Max port blocks per host Maximum number of blocks that one host can use for translation.
Port block active timeout Longest duration that a block remains active for port allocation.
Used/total port blocks Current number of used ports and the total number of ports in this source pool.
Port_Block Range Port range of one PBA port block entry from the lowest to the highest port number that
can be allowed to allocate ports for this block.
Ports_Used/Ports_Total Current number of used ports and total number of ports in this source pool.
Block_State/Left_Time(s) PBA port block entry state for NAT port allocation, including Active, Inactive, Query, and
the time left for a port block that is in the Active state or Query state.
Last active block recycle timeout Amount of time before the last active block is released when active-port-block-timeout
is set to zero.
Sample Output
Pool name: p1
Port-overloading-factor: 1 Port block size: 128
Max port blocks per host: 4 Port block active timeout: 0
Used/total port blocks: 1/118944
Host_IP External_IP Port_Block Ports_Used/ Block_State/
Range Ports_Total Left_Time(s)
203.0.113.1 198.51.100.20 51328-51455 2/128*1 Active/-
Sample Output
Release Information Command introduced in Junos OS Release 9.2. Support for IPv6 addresses added in
Junos OS Release 11.2.
The Description output field added in Junos OS Release 12.1.
Support for IPv6 logical systems and the Source port, Successful sessions, Failed sessions,
and Number of sessions output fields added in Junos OS Release 12.1X45-D10.
Output for multiple destination ports and the application output field added in Junos OS
Release 12.1X47-D10.
The tenant option is introduced in Junos OS Release 18.3R1.
Description Display information about the specified source Network Address Translation (NAT) rule.
logical-system—Display information about the source NAT rules for a specified logical
system. Specify all to display information for all logical systems.
root-logical-system—Display information about the source NAT rules for the master
(root) logical system.
tenant—Display information about the source NAT rules for a specified tenant system.
Specify all to display information for all tenant systems.
List of Sample Output show security nat source rule r2 on page 378
show security nat source rule all on page 378
show security nat source rule all tenant on page 379
Output Fields Table 27 on page 377 lists the output fields for the show security nat source rule command.
Output fields are listed in the approximate order in which they appear
Total referenced IPv4/IPv6 Number of IP prefixes referenced in source, destination, and static NAT rules. This total
ip-prefixes includes the IP prefixes configured directly, as address names, and as address set names
in the rule.
From zone Name of the zone from which the packets flow.
From routing instance Name of the routing instance from which the packets flow.
To routing instance Name of the routing instance to which the packets flow.
From interface Name of the interface from which the packets flow.
Source addresses Name of the source addresses that match the rule.
Destination address Name of the destination addresses that match the rule.
Action The action taken in regard to a packet that matches the rule’s tuples. Actions include
the following:
Table 27: show security nat source rule Output Fields (continued)
Successful sessions Number of successful session installations after the NAT rule is matched.
Failed sessions Number of unsuccessful session installations after the NAT rule is matched.
Sample Output
Sample Output
To zone : untrust
Match
Source addresses : 192.0.2.0 - 192.0.2.255
Destination addresses : 203.0.113.0 - 203.0.113.255
198.51.100.0 - 198.51.100.255
Application : configured
Action : off
Persistent NAT type : N/A
Persistent NAT mapping type : address-port-mapping
Inactivity timeout : 0
Max session number : 0
Translation hits : 0
Successful sessions : 0
Failed sessions : 0
Number of sessions : 0
Sample Output
Total rules: 1
Total referenced IPv4/IPv6 ip-prefixes: 2/0
source NAT rule: r1 Rule-set: from_intf
Rule-Id : 1
Rule position : 1
From interface : ge-0/0/0.0
To interface : ge-0/0/1.0
Match
Source addresses : 192.168.1.0 - 192.168.1.255
Destination addresses : 203.0.113.200 - 203.0.113.200
Action : pat
Persistent NAT type : N/A
Persistent NAT mapping type : address-port-mapping
Inactivity timeout : 0
Max session number : 0
Translation hits : 0
Successful sessions : 0
Failed sessions : 0
Number of sessions : 0
Description Display information about the specified source Network Address Translation (NAT) rule
application.
Options rule-name—Display information about the specified source NAT rule application.
Related • Logical Systems and Tenant Systems Feature Guide for Security Devices
Documentation
List of Sample Output show security nat source rule-application for port application on page 381
show security nat source rule-application for ICMP application on page 381
Output Fields Table 28 on page 380 lists the output fields for the show security nat source rule-application
command. Output fields are listed in the approximate order in which they appear.
Table 28: show security nat source rule-application Output Fields (continued)
Sample Output
Sample Output
root-logical-system—Display summary information about the source NAT for the master
(root) logical system.
tenant—Display summary information about the source NAT for a specified tenant
system. Specify all to display information for all tenant systems.
List of Sample Output show security nat source summary on page 383
show security nat source summary tenant on page 384
Output Fields Table 29 on page 383 lists the output fields for the show security nat source summary
command. Output fields are listed in the approximate order in which they appear.
Total port number usage for port Number of ports assigned to the pool.
translation pool
Maximum port number for port Maximum number of NAT or PAT transactions done at any given time.
translation pool
Sample Output
Total rules: 1
Total rules: 1
Rule name Rule set From To Action
r1 from_intf ge-0/0/0.0 ge-0/0/1.0 pat
Description Display information about the specified static Network Address Translation (NAT) rule.
Traffic directions allows you to specify from interface, from zone, or from routing-instance
and packet information can be source addresses and ports, and destination addresses
and ports.
logical-system—Display information about the static NAT rules for a specified logical
system. Specify all to display information for all logical systems.
root-logical-system—Display information about the static NAT rules for the master
(root) logical system.
tenant—Display information about the static NAT rules for a specified tenant system.
Specify all to display information for all tenant systems.
List of Sample Output show security nat static rule on page 387
show security nat static rule all tenant on page 387
show security nat static rule (IPv6) on page 387
show security nat static rule all on page 388
Output Fields Table 30 on page 386 lists the output fields for the show security nat static rule command.
Output fields are listed in the approximate order in which they appear.
Total referenced IPv4/IPv6 Number of IP prefixes referenced in source, destination, and static NAT rules. This total
ip-prefixes includes the IP prefixes configured directly, as address names, and as address set names
in the rule.
Rule-set Name of the rule set. Currently, you can configure 8 rules within the same rule set.
Rule position Position of the rule that indicates the order in which it applies to traffic.
From interface Name of the interface from which the packets flow.
From routing instance Name of the routing instance from which the packets flow.
From zone Name of the zone from which the packets flow.
Destination addresses Name of the destination addresses that match the rule.
Source addresses Name of the source addresses that match the rule.
Host addresses Name of the host addresses that match the rule.
Destination port Destination port numbers that match the rule. The default value is any.
Translation hits Number of times a translation in the translation table is used for a static NAT rule.
Successful sessions Number of successful session installations after the NAT rule is matched.
Table 30: show security nat static rule Output Fields (continued)
Failed sessions Number of unsuccessful session installations after the NAT rule is matched.
Sample Output
Sample Output
Sample Output
Sample Output