> Source: [sk163401](https://support.checkpoint.com/results/sk/sk163401)

# sk163401 - How to keep same source port on Hide NAT

| Property | Value |
|----------|-------|
| Solution ID | sk163401 |
| Date Created | 2019-11-06 |
| Last Modified | 2022-01-26 |
| Technical Level | General |
| Products | Security Gateway |
| Versions | R82.10, R82, R81.20 |
| OS | Gaia |

## Solution

**Abstract**
This problem was fixed. The fix is included in:  

* [Check Point R80.40](https://supportcenter.checkpoint.com/supportcenter/portal?eventSubmit_doGoviewsolutiondetails=&solutionid=sk160736)
* [Jumbo Hotfix Accumulator for R80.30](https://supportcenter.checkpoint.com/supportcenter/portal?eventSubmit_doGoviewsolutiondetails=&amp;solutionid=sk153152) since Take 107
* [Jumbo Hotfix Accumulator for R80.20](https://supportcenter.checkpoint.com/supportcenter/portal?eventSubmit_doGoviewsolutiondetails=&solutionid=sk137592) since Take 117
* [Jumbo Hotfix Accumulator for R80.10](https://supportcenter.checkpoint.com/supportcenter/portal?eventSubmit_doGoviewsolutiondetails=&solutionid=sk116380) since Take 245

<br />

A connection or application requires the source port to be the same after NAT. By default, the Security Gateway will assign a random high port to the connection after NAT even if the translated port is set to keep the "original source port".

For a solution [Contact Check Point Support](https://www.checkpoint.com/support-services/contact-support/) to get a Hotfix for this issue.   
A Support Engineer will make sure the Hotfix is compatible with your environment before providing the Hotfix.   
For faster resolution and verification please collect [CPinfo](https://supportcenter.checkpoint.com/supportcenter/portal?eventSubmit_doGoviewsolutiondetails=&solutionid=sk92739) files from the Security Management and Security Gateways involved in the case.

Fix needs to be installed on the **Security Gateway**.

After the installation, perform the following steps:

1. Login to the Securiity Management/Multi-Domain Server via CLI. For an MDS, login to the relevant CMA with: mdsenv \<CMAIP\>

<br />

1. Backup the *$FWDIR/user.def.FW1* file :  

   NOTE: Please refer to [sk98239](https://supportcenter.checkpoint.com/supportcenter/portal?eventSubmit_doGoviewsolutiondetails=&solutionid=sk98239&partition=Advanced&product=Security "location of user.def file") for the correct file depending on your version.

Eg: cp $FWDIR/conf/user.def.FW1 $FWDIR/conf/user.def.FW1.orig

1. Modify the file:

Following tables can be added as required - **fw_src_dont_alloc_sport** and **fw_dest_dont_alloc_sport**.

For example if you wish not to allocate source port for destination IP 1.2.3.4 and destination port 443 add the following line in user.def.FW1 file:

fw_dest_dont_alloc_sport = {\<1.2.3.4, 443\>};

General form is - fw_dest_dont_alloc_sport = {\<dest_ip1, dport1\>, .... , \<dest_ipN, dportN\>};

*(NOTE - exactly the same goes for fw_src_dont_alloc_sport, but of course for src_ip1 ... src_ipM)*

1. Save the new modified file after the changes.

<br />

1. Push policy from the Management server.

<br />

1. To test the fix use 'fw monitor' and make sure the connections exits the gateway with the same source port as in the inbound.

---

# Agent Instructions

This content is from the Check Point Support Center (https://support.checkpoint.com), the official knowledge base for Check Point cybersecurity products.

## Navigating This Knowledge Base

- **Complete index**: [llms.txt](https://support.checkpoint.com/llms.txt)
- **All SK articles**: [SecureKnowledge Sitemap](https://support.checkpoint.com/sitemaps/secureknowledge-sitemap-index.xml)
- **SK article URL pattern**: `https://support.checkpoint.com/results/sk/{skId}`
- **Markdown responses**: AI bot User-Agents automatically receive `text/markdown` content
