<?xml version="1.0" encoding="UTF-8"?>        <rss version="2.0"
             xmlns:atom="http://www.w3.org/2005/Atom"
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
             xmlns:admin="http://webns.net/mvcb/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:content="http://purl.org/rss/1.0/modules/content/">
        <channel>
            <title>
									Dynamic NAT on Juniper SRX - Juniper Firewall				            </title>
            <link>https://www.hacktheforum.com/juniper-firewall/dynamic-nat-on-juniper-srx/</link>
            <description>Hack The Forum Discussion Board</description>
            <language>en</language>
            <lastBuildDate>Sat, 18 Apr 2026 05:33:18 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>Dynamic NAT on Juniper SRX</title>
                        <link>https://www.hacktheforum.com/juniper-firewall/dynamic-nat-on-juniper-srx/#post-802</link>
                        <pubDate>Sat, 23 Nov 2024 10:08:29 +0000</pubDate>
                        <description><![CDATA[Dynamic NAT (Network Address Translation) is used to automatically map an internal private IP address to a public IP address from a pool of public IPs. Unlike Static NAT, where a single inte...]]></description>
                        <content:encoded><![CDATA[<p>Dynamic NAT (Network Address Translation) is used to automatically map an internal private IP address to a public IP address from a pool of public IPs. Unlike <strong>Static NAT</strong>, where a single internal IP is always mapped to a specific external IP, <strong>Dynamic NAT</strong> dynamically assigns one of the available public IP addresses from a pool whenever an internal host needs to communicate with the outside world.</p>
<p>In <strong>Juniper SRX</strong> devices, Dynamic NAT is configured using the <code>security nat source</code> command. Typically, Dynamic NAT is used for outbound traffic, where multiple internal clients share a limited number of public IP addresses.</p>
<h3><strong>Steps to Configure Dynamic NAT on Juniper SRX:</strong></h3>
<h4><strong>1. Access the SRX Device:</strong></h4>
<p>Log in to your SRX device through SSH, console, or J-Web interface.</p>
<hr />
<h4><strong>2. Define the Address Pool (Public IP Pool):</strong></h4>
<p>You need to create a pool of public IP addresses that will be used for the dynamic translation. For example, if you have three public IPs (<code>203.0.113.10</code>, <code>203.0.113.11</code>, and <code>203.0.113.12</code>), you will create an address pool that includes these IPs.</p>
<div class="contain-inline-size rounded-md border- border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950">
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-bash"><code class="!whitespace-pre hljs language-bash"></code></code>
<pre contenteditable="false">set security nat source pool my-nat-pool address 203.0.113.10/32
set security nat source pool my-nat-pool address 203.0.113.11/32
set security nat source pool my-nat-pool address 203.0.113.12/32
</pre>
</div>
</div>
<p>Here:</p>
<ul>
<li><strong><code>my-nat-pool</code></strong>: The name of the NAT pool.</li>
<li><strong><code>203.0.113.10/32, 203.0.113.11/32, 203.0.113.12/32</code></strong>: The public IPs in the pool. <code>/32</code> indicates a single IP address.</li>
</ul>
<hr />
<h4><strong>3. Define the NAT Rule (Source NAT):</strong></h4>
<p>Now, create the Dynamic NAT rule to translate the internal IPs to the public IPs in the pool. This rule will allow all internal clients to share the public IP pool when accessing external resources.</p>
<div class="contain-inline-size rounded-md border- border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950">
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-bash"><code class="!whitespace-pre hljs language-bash"></code></code>
<pre contenteditable="false">set security nat source rule-set my-nat-rule-set from trust to untrust rule my-nat-rule match source-address 192.168.1.0/24
set security nat source rule-set my-nat-rule-set from trust to untrust rule my-nat-rule then source-nat pool my-nat-pool
</pre>
</div>
</div>
<p>Here:</p>
<ul>
<li><strong><code>my-nat-rule-set</code></strong>: The name of the NAT rule set.</li>
<li><strong><code>trust</code></strong>: The name of the internal network (zone).</li>
<li><strong><code>untrust</code></strong>: The name of the external network (zone, typically the internet).</li>
<li><strong><code>my-nat-rule</code></strong>: The name of the specific NAT rule.</li>
<li><strong><code>192.168.1.0/24</code></strong>: The internal network (private IP range) that will be mapped to the public IP pool.</li>
<li><strong><code>my-nat-pool</code></strong>: The NAT pool you created earlier.</li>
</ul>
<hr />
<h4><strong>4. Configure Security Policies:</strong></h4>
<p>After setting up the NAT rule, you need to configure security policies to allow traffic between the <code>trust</code> (internal) and <code>untrust</code> (external) zones.</p>
<div class="contain-inline-size rounded-md border- border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950">
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-bash"><code class="!whitespace-pre hljs language-bash"></code></code>
<pre contenteditable="false">set security policies from-zone trust to-zone untrust policy allow-internet match source-address any destination-address any application any
set security policies from-zone trust to-zone untrust policy allow-internet then permit
</pre>
</div>
</div>
<p>This policy allows traffic from any source address in the <strong><code>trust</code></strong> zone to any destination in the <strong><code>untrust</code></strong> zone (the internet).</p>
<hr />
<h4><strong>5. Commit the Configuration:</strong></h4>
<p>Once the configuration is complete, you must commit the changes to apply them to the SRX device.</p>
<div class="contain-inline-size rounded-md border- border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950">
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-bash"><code class="!whitespace-pre hljs language-bash"></code></code>
<pre contenteditable="false">commit
</pre>
</div>
</div>
<hr />
<h4><strong>6. Verify the Configuration:</strong></h4>
<p>To verify that Dynamic NAT is working properly, you can check the NAT translation table and the source NAT rules.</p>
<ul>
<li><strong>Check the Source NAT Configuration:</strong></li>
</ul>
<div class="contain-inline-size rounded-md border- border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950">
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-bash"><code class="!whitespace-pre hljs language-bash"></code></code>
<pre contenteditable="false">show security nat source rule-set
</pre>
</div>
</div>
<p>This command will show the configuration of the source NAT rule sets, including the pool of IPs used for dynamic NAT.</p>
<ul>
<li><strong>Check Active NAT Translations:</strong></li>
</ul>
<div class="contain-inline-size rounded-md border- border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950">
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-bash"><code class="!whitespace-pre hljs language-bash"><span class="hljs-built_in"></span></code></code>
<pre contenteditable="false">show security nat source
</pre>
</div>
</div>
<p>This command displays the active source NAT translations, showing which internal IPs have been translated to which public IPs.</p>]]></content:encoded>
						                            <category domain="https://www.hacktheforum.com/juniper-firewall/">Juniper Firewall</category>                        <dc:creator>paul0000</dc:creator>
                        <guid isPermaLink="true">https://www.hacktheforum.com/juniper-firewall/dynamic-nat-on-juniper-srx/#post-802</guid>
                    </item>
							        </channel>
        </rss>
		