<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: NAT Cache Table Full in General Topics</title>
    <link>https://community.checkpoint.com/t5/General-Topics/NAT-Cache-Table-Full/m-p/53550#M10692</link>
    <description>&lt;P&gt;The quoted text was from the second edition of my book, the first edition covered the NAT cache table in a more cursory fashion within the context of SecureXL NAT templates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 16 May 2019 00:46:37 GMT</pubDate>
    <dc:creator>Timothy_Hall</dc:creator>
    <dc:date>2019-05-16T00:46:37Z</dc:date>
    <item>
      <title>NAT Cache Table Full</title>
      <link>https://community.checkpoint.com/t5/General-Topics/NAT-Cache-Table-Full/m-p/53546#M10688</link>
      <description>&lt;P&gt;'fw tab -t fwx_cache -s' is showing it full at 10000.&amp;nbsp; Per SK21834, there is no adverse affect and any additional traffic is just matched against the NAT rules, instead of the NAT cache table entries.&amp;nbsp; Will changing the value to something like 20000 improve performance or is there some kind of tradeoff in memory?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The current memory utilization:&lt;/P&gt;&lt;P&gt;total used free shared buffers cached&lt;BR /&gt;Mem: 64206 6662 57544 0 340 2679&lt;BR /&gt;-/+ buffers/cache: 3642 60564&lt;BR /&gt;Swap: 18449 0 18449&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2019 23:24:22 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/General-Topics/NAT-Cache-Table-Full/m-p/53546#M10688</guid>
      <dc:creator>David_Chau</dc:creator>
      <dc:date>2019-05-15T23:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: NAT Cache Table Full</title>
      <link>https://community.checkpoint.com/t5/General-Topics/NAT-Cache-Table-Full/m-p/53547#M10689</link>
      <description>&lt;P&gt;This topic was covered extensively in my book, along with a way to try to judge whether increasing the cache size will help:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;P&gt;&lt;STRONG&gt;The NAT Cache&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;The first packet of a new connection accepted by the Network Access layer that involves&lt;BR /&gt;NAT will always make a trip to the Firewall Path (F2F) by default, unless NAT&lt;BR /&gt;Templates are enabled. Even if the firewall has a very large NAT rulebase, most of the&lt;BR /&gt;time the firewall doesn't even have to evaluate it due to the NAT Cache Table&lt;BR /&gt;fwx_cache which is enabled by default. Essentially the most common NAT rulebase&lt;BR /&gt;hits are cached in a special state table that can determine the required NAT operation&lt;BR /&gt;quite efficiently during future NAT lookups. The presence of this NAT caching&lt;BR /&gt;mechanism is probably why hit counts are not available for NAT rules. Once the first&lt;BR /&gt;packet of an accepted connection has been NATted, the NAT rulebase and its&lt;BR /&gt;fwx_cache table is never consulted again for that particular connection, and as such the&lt;BR /&gt;NAT applied to a connection's packets cannot ever change after the connection’s first&lt;BR /&gt;packet.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;By default this NAT cache can contain up to 10,000 cached NAT entries (the cached&lt;BR /&gt;entries are expired from the table after 30 minutes by default). Whenever an “Original&lt;BR /&gt;Packet” NAT rule match occurs in the NAT rule base, the source, destination, and&lt;BR /&gt;service port number associated with the matched NAT rule are cached in the fwx_cache&lt;BR /&gt;table, along with the necessary NAT operation to be performed under “Translated&lt;BR /&gt;Packet”. If the same source, destination, and service port number show up for a new&lt;BR /&gt;allowed connection, the NAT rulebase itself is never consulted, and the cached NAT&lt;BR /&gt;operation is performed instead thus saving the overhead of a full NAT rulebase lookup.&lt;BR /&gt;So how many of the potential 10,000 NAT cache entries are in use on your firewall?&lt;BR /&gt;Run the command &lt;STRONG&gt;fw tab -t fwx_cache –s&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;#VALS indicates the number of current cached NAT entries and #PEAK indicates the&lt;BR /&gt;peak number of entries in the table used since the firewall was last booted. If both&lt;BR /&gt;#VALS and #PEAK are substantially less than 10,000, either you are not doing very much&lt;BR /&gt;NAT on your firewall, or a maximal level of NAT caching is already occurring in the&lt;BR /&gt;Firewall Path and there is nothing more to do.&lt;/P&gt;
&lt;P&gt;However, what if #PEAK shows 10,000 exactly? First off, fear not. Using up all the&lt;BR /&gt;entries in the NAT cache table does not cause an outage or otherwise impede traffic; it&lt;BR /&gt;just results in more NAT rulebase lookups then there otherwise would be, which does&lt;BR /&gt;impact performance. So how can we assess whether the NAT cache size should be&lt;BR /&gt;increased?&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;As mentioned earlier, hit counts are not available for NAT rules. However you can&lt;BR /&gt;poke around directly in the fwx_cache table on the live gateway to get an idea of which&lt;BR /&gt;NAT rules are being used the most. The fwx_cache table does track the NAT rule&lt;BR /&gt;number of cached entries; this lengthy command will show the top 20 most commonly&lt;BR /&gt;cached/hit NAT rules:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;fw tab -u -t fwx_cache|awk '{ print $3 }'|cut -c5-8|sort -n|uniq -c| sort -nr|head -20&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Hopefully you should now have a good idea of the most commonly hit rules in your&lt;BR /&gt;NAT policy. But here comes the next big question: If the #PEAK value for the&lt;BR /&gt;fwx_cache table is exactly 10,000, how much would potentially increasing the NAT&lt;BR /&gt;cache size help? There is no direct way to answer this question, but there is a way to see&lt;BR /&gt;how much CPU overhead the NAT cache is currently saving at its current size: we can&lt;BR /&gt;simply turn it off and see what happens to CPU utilization on the firewall!&lt;/P&gt;
&lt;P&gt;To accomplish this, run the command &lt;STRONG&gt;mpstat 1&lt;/STRONG&gt; in a separate window. This&lt;BR /&gt;command will show CPU utilization (user/sys/soft/hi as also shown in the top&lt;BR /&gt;command) once per second. Let the command run for a while to get a good idea of the&lt;BR /&gt;firewall’s current CPU load. Now in a separate window disable the NAT cache on the&lt;BR /&gt;fly with: fw ctl set int fwx_do_nat_cache 0 . Observe the CPU utilization&lt;BR /&gt;closely after the change. Does it go up, down or stay the same? You can probably draw&lt;BR /&gt;your own conclusions about what to do given what you’ve observed thus far, but in&lt;BR /&gt;general if the CPU load remains the same or drops (and earlier #PEAK showed exactly&lt;BR /&gt;10,000 or whatever the limit was set to) increasing the fwx_cache won’t help. If&lt;BR /&gt;however the overall CPU load went up, and especially if it went up a lot, increasing the&lt;BR /&gt;fwx_cache size may help especially if you have a large NAT rulebase (1500+ rules).&lt;/P&gt;
&lt;P&gt;Before considering an increase in the NAT cache size, make sure firewall has plenty&lt;BR /&gt;of free memory (run &lt;STRONG&gt;free -m&lt;/STRONG&gt; and look at the third line as detailed in the last chapter).&lt;BR /&gt;The fwx_alloc table by default can have up to 10,000 entries, and it appears that each&lt;BR /&gt;entry consumes about 50 bytes of memory, so the maximum amount of RAM that&lt;BR /&gt;fwx_alloc can consume by default is 500,000 bytes (or about 500Kbytes). To increase&lt;BR /&gt;the NAT cache size see &lt;A class="cp_link sc_ellipsis" style="max-width: 840px;" href="https://supportcenter.checkpoint.com/supportcenter/portal?eventSubmit_doGoviewsolutiondetails=&amp;amp;solutionid=sk21834&amp;amp;partition=Advanced&amp;amp;product=Security" target="_blank"&gt;sk21834: How to modify values of properties related to NAT cache table "fwx_cache"&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have determined that you need to increase it, I’d recommend just&lt;BR /&gt;doubling the fwx_cache size to start with – please resist the urge to crank it up to an&lt;BR /&gt;obnoxiously high value as that can cause its own problems and actually hurt&lt;BR /&gt;performance. After increasing the value run the commands shown earlier again to assess&lt;BR /&gt;the impact of the change, and if it still needs to be increased try doubling it again. Just&lt;BR /&gt;don’t forget to turn the NAT cache back on by setting fwx_do_nat_cache back to 1&lt;BR /&gt;when you are done!&lt;/P&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2019 00:25:03 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/General-Topics/NAT-Cache-Table-Full/m-p/53547#M10689</guid>
      <dc:creator>Timothy_Hall</dc:creator>
      <dc:date>2019-05-16T00:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: NAT Cache Table Full</title>
      <link>https://community.checkpoint.com/t5/General-Topics/NAT-Cache-Table-Full/m-p/53549#M10691</link>
      <description>Thanks Tim, exactly what I needed. I do have your book but didn't see anything for the NAT cache, maybe I need to dig through it again or maybe it is in your new book.</description>
      <pubDate>Thu, 16 May 2019 00:32:01 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/General-Topics/NAT-Cache-Table-Full/m-p/53549#M10691</guid>
      <dc:creator>David_Chau</dc:creator>
      <dc:date>2019-05-16T00:32:01Z</dc:date>
    </item>
    <item>
      <title>Re: NAT Cache Table Full</title>
      <link>https://community.checkpoint.com/t5/General-Topics/NAT-Cache-Table-Full/m-p/53550#M10692</link>
      <description>&lt;P&gt;The quoted text was from the second edition of my book, the first edition covered the NAT cache table in a more cursory fashion within the context of SecureXL NAT templates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2019 00:46:37 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/General-Topics/NAT-Cache-Table-Full/m-p/53550#M10692</guid>
      <dc:creator>Timothy_Hall</dc:creator>
      <dc:date>2019-05-16T00:46:37Z</dc:date>
    </item>
  </channel>
</rss>

