Port forwarding, dynamic DNS and UPnP: making a service reachable, and safer alternatives
In short: Port forwarding tells a NAT router to send traffic arriving on a public port to a device inside the network. Dynamic DNS updates a name whenever the home IP address changes, and UPnP lets devices create forwards automatically. Exposing services this way is risky, especially remote desktop and camera systems, so a VPN or an outbound tunnel service is usually safer.
Why it is needed
NAT lets many devices share one public IP address, but it also means nothing on the internet can start a connection to a device inside. If you want to reach a home server, a CCTV recorder or a game server from outside, the router needs a rule saying "traffic arriving on this port goes to that device". That rule is a port forward (also called destination NAT or a virtual server).
Setting up a port forward
- Give the internal device a fixed address, ideally with a DHCP reservation.
- In the router, create a rule: external port (for example TCP 443) to internal IP 192.168.1.50, port 443.
- Make sure the device's own firewall allows the traffic.
- Test from outside, for example from a phone on mobile data, not from inside the home network (many routers do not support "hairpin" access to the public address from inside).
Port forwarding does not work if the router is behind CGNAT or double NAT, because the router does not own the public address.
Dynamic DNS
Most home connections get a public IP that can change. Dynamic DNS (DDNS) services (No-IP, DuckDNS, and many router vendors' own) give you a name such as myhome.example.net. The router, or a small program on a PC, updates the name whenever the address changes, so you can always connect by name.
UPnP
Universal Plug and Play lets devices and apps on the network ask the router to open ports automatically. Game consoles use it to get an "open NAT" type. The problem is that any device can ask, including malware or a poorly made camera, and the user never sees it. If you use UPnP, check its list of mappings occasionally; if you do not need it, turn it off.
The risks
A forwarded port puts that device directly on the internet, where automated scanners find it within minutes. Remote desktop (RDP, port 3389), old NAS devices, CCTV recorders and home automation hubs are constantly attacked. Many ransomware incidents in small businesses started with an exposed RDP port. If you must forward a port:
- keep the device fully updated and use strong, unique passwords with MFA;
- never forward RDP, SMB or admin interfaces;
- limit the rule to known source addresses if the router allows it.
Safer alternatives
- A VPN into the home or office (WireGuard or OpenVPN on the router or a small server): only one port is exposed, and it does nothing without the right keys.
- Overlay VPNs such as Tailscale or ZeroTier: devices connect outward and find each other, with no ports forwarded at all, and they work behind CGNAT.
- Outbound tunnel services such as Cloudflare Tunnel publish a web service through the provider's network, with optional login in front.
- Vendor cloud apps for cameras and smart devices, if you trust the vendor.
Real-world example: the dentist's remote desktop
A small dental practice forwarded port 3389 so the owner could use remote desktop from home. Months later, an attacker guessed a weak password and installed ransomware over a weekend. The recovery plan removed the port forward, set up a WireGuard VPN with keys on the owner's laptop, and added MFA for remote logins.
Practice
What does a port forward do?
What problem does dynamic DNS solve?
Why is forwarding RDP (port 3389) a bad idea?
Key takeaways
- Port forwarding lets outside users reach a device behind NAT.
- Dynamic DNS keeps a name updated when the public IP changes.
- UPnP opens ports automatically; disable it if not needed.
- Prefer VPNs or outbound tunnels to exposing services directly.
Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.