Static NAT (Network Address Translation) is a one-to-one mapping between a private IP address (internal) and a public IP address (external). This is often used for allowing external clients to access internal servers, such as web servers, email servers, or any other resources that need to be directly accessible from the internet.
On a Juniper SRX device, static NAT is configured using the security nat static
command. This type of NAT allows inbound traffic to be directed to an internal host by mapping a public IP address to an internal private IP address.
Steps to Configure Static NAT on Juniper SRX:
Here's a step-by-step guide to configure Static NAT on a Juniper SRX device:
1. Access the SRX Device:
- Log in to the SRX device via SSH, console, or the J-Web interface.
2. Configure the Static NAT Rule:
You'll need to configure a static NAT rule that specifies:
- Source IP: The external/public IP address.
- Destination IP: The internal/private IP address.
Basic Configuration Command:
Where:
<rule-set-name>
: Name for the rule set (e.g., "static-nat").<zone-name>
: The name of the security zones involved in the NAT translation.<rule-name>
: The name of the specific rule.<public-ip>
: The public IP address (external IP) that will be mapped to the private IP.<private-ip>
: The internal IP address of the machine you want to make accessible.
Example:
Let's assume:
- Public IP:
203.0.113.10
(the external IP provided by the ISP). - Private IP:
192.168.1.10
(the internal IP of the server you want to expose). - Zone: We will assume
untrust
is the external zone andtrust
is the internal zone.
In this example:
- Any traffic destined for
203.0.113.10
(public IP) will be forwarded to192.168.1.10
(private IP) within thetrust
zone. - The rule set is named
static-nat
, and the rule is1
.
3. Commit the Configuration:
After configuring the NAT rule, commit the changes to the device:
commit
4. (Optional) Configure Security Policies:
In addition to the static NAT rule, you must configure security policies to allow traffic to flow between the relevant zones (e.g., from the untrust
zone to the trust
zone).
Example to allow inbound traffic from the untrust zone to the trust zone for the mapped public IP:
This policy:
- Allows traffic from any source to the public IP (
203.0.113.10
), for any application. - The traffic is then permitted through the firewall.
You can adjust the source-address and application as needed to restrict access.
Â
5. Verify the Configuration:
After applying the configuration, you can verify that the static NAT rule is working as expected using the following commands:
Check NAT Rules:
Check Traffic Flow:
To check if the NAT translation is working:
This will display any active sessions that are using the mapped public IP (203.0.113.10
).
Â
Â