Tutorials · Routing & Internet

How to Use NAT and Port Forwarding Safely

Understand source NAT, destination NAT and port forwarding, when to use them, and how to publish a service without exposing your network.

Intermediate12 min7 steps

Before you start

  • A gateway or firewall
  • A public IP address

Step by step

  1. Understand source NAT

    Source NAT (masquerade) lets private addresses reach the Internet using the public IP. It is enabled on almost every Internet gateway by default.

  2. Ask whether you need port forwarding at all

    Most remote-access needs (CCTV, RDP, device management) should use a VPN instead. Forward ports only for real public services such as a web or mail server.

  3. Put published servers in a DMZ

    Place Internet-facing servers in their own VLAN with firewall rules that block access from the DMZ to internal networks.

  4. Create the forward with limits

    Forward only the exact port, to one server, and restrict source IPs if the service is for partners only.

    ip nat inside source static tcp 10.50.0.10 443 <public-ip> 443
    
  5. Harden the server

    Patch it, use TLS, enable logging and protect logins with rate limiting and 2FA.

  6. Disable UPnP

    UPnP lets devices open ports automatically. Turn it off on business gateways.

  7. Review forwards quarterly

    Delete forwards nobody uses and scan your public IP to see what is exposed.

Commands are generic, industry-standard examples. Exact syntax and menu names vary by model and firmware; check your device's manual on the Documentation page.

Pro tips

  • Never forward ports for camera, NVR or switch management pages.
  • Use a reverse proxy to publish several web services on one IP safely.
How to Use NAT and Port Forwarding Safely | Navijin Tutorials