Example: Configuring Source NAT (CLI)
When source NAT is performed, source pools provide JUNOS Software with a supply of addresses from which to draw. When a NAT rule requires NAT and references a specific source pool, JUNOS Software draws addresses from that pool when translation is performed.
![]() | Note: When the JUNOS Software performs source NAT, security policies are applied first, and then the address in question is translated according to configured NAT source rules. |
Source NAT rules have three available actions:
- off — Do not perform source NAT.
- pool — Use user-defined source NAT pools to perform source NAT.
- interface — Use the egress interface IP address to perform source NAT.
![]() | Note: The off action is a useful command for detail control when you are configuring source NAT rules. For example, you can configure a rule that says, “if rule A is from zone1 to zone2, do source NAT.” However, you do not want source NAT performed if the traffic egresses from interface if2, which belongs to zone2. In that case, you can define a rule B, which is from zone1 to if2 with off as the source NAT action. |
In this example, you perform the following tasks:
- Define a source NAT pool for traffic from routing-instance ri-2 to routing-instance ri-1 with any source IP address and destination IP address 30.1.1.1. Map the source IP address to 10.1.1.1.
- Define a source NAT pool for traffic from zone z3 or z4 to routing-instance ri-1 with any source IP address and destination IP address 30.1.1.2. Map the source IP address to 10.1.1.2.
- Define a source NAT pool for traffic from interface fe-0/0/0.0 or fe-0/0/1.0 to interface ge-1/0/0.0 or ge-1/0.1.0 with any source IP address and destination IP address 30.1.1.3. Map the source IP address to 10.1.1.3.
- Define a source NAT pool for traffic from routing-instance ri-2 to zone z2 with any source IP address and destination IP address 30.1.1.4. Map the source IP address to 10.1.1.4.
- Define a source NAT pool for traffic from routing-instance ri-2 to routing-instance ri-1 with any source IP address and destination IP address 30.1.1.5. Map the source IP address to 10.1.1.5.
To configure source NAT pools:
To configure source NAT rules:
Related Topics
- JUNOS Software Feature Support Reference for SRX Series and J Series Devices
- Source NAT Configuration Overview
- Understanding Source NAT
- Example: Configuring Source NAT Pools (CLI)
- Verifying NAT Configuration