Internet & Networking

Port forwarding

Also known as: port mapping, port forward, port-forwarding

Port forwarding is a router setting that sends incoming traffic arriving on a specific port to a particular device on your network, such as a game console, security camera recorder, or home server.

It's needed because NAT normally blocks unsolicited connections from the internet. While port forwarding can fix connection problems, every forwarded port is an opening into your network, and many compromised cameras and devices were reached exactly this way.

Port forwarding, explained at three levels

At home

Picture an apartment building with one street address and a front desk. Visitors can't reach a unit unless the desk knows where to send them. Your router is that desk: your whole home shares one public internet address, and unexpected visitors are turned away. A port forwarding rule tells the desk that anyone arriving at door 25565 should be sent straight up to your gaming PC.

At work

Port forwarding is a firewall or router rule that sends incoming internet traffic on a chosen port to one device inside the network. Businesses use it to publish an internal service, such as a VPN gateway, mail server, or camera recorder, to the outside world. It matters because every rule creates a direct path from the internet to an internal machine, which attackers actively look for.

Real-world examples

At home

Carlos wanted to host a game server for friends. He forwarded the game's port on his router to his PC, then removed the rule when they finished playing.

At work

Fatima discovered an old port forwarding rule at a client's office that exposed a camera recorder to the internet. She removed it and set up secure remote viewing through the vendor's app instead.

How it compares

featurePort forwardingUPnP
Who opens the portYou, manuallyDevices, automatically
ControlPreciseLittle visibility
RiskDepends on the ruleHigher, malware can use it
ConvenienceLowerHigh

Manual forwarding is controlled. UPnP is convenient but harder to audit.

For analysts

I'd keep a documented list of every forwarded port with an owner and a reason. Anything nobody can explain should be closed.

History & origin

Port forwarding became common with home routers in the late 1990s and 2000s, as NAT made it impossible for outside connections to reach devices inside a home network. Universal Plug and Play (UPnP), introduced around 2000 and 2001, let devices open ports automatically, which was convenient but risky. In 2016, the Mirai botnet hijacked hundreds of thousands of internet-exposed cameras and routers with default passwords and used them in massive attacks that disrupted major websites. Since then, many device makers have moved to cloud relay services that don't require opening ports, and security guidance increasingly recommends VPNs instead. In my view, port forwarding is a tool from a more trusting era of the internet.