1. From https://en.wikipedia.org/wiki/Port_forwarding

    In computer networking, port forwarding or port mapping is an application of network address translation (NAT) that redirects a communication request from one address and port number combination to another while the packets are traversing a network gateway, such as a router or firewall.

    I think that network address translation (what a NAT device does) isn't necessarily involved in port forwarding (e.g SSH port forwarding), by their definitions. So why does wikipedia say port forwarding is an application of NAT? Can you explain from their definitions?

  2. Is it correct that what is said for "port forwarding" in a commercial router (commercial in the sense of including NAT) so that a computer outside a LAN can access a service inside the LAN isn't actually "port forwarding", but NAT?


Without NAT, port forwarding doesn't exist. Port forwarding is a function of NAT that allows traffic addressed to the outside interface, on a particular port, to be forwarded to a host on the inside network.

For instance, if I have a web server on an inside network with private addressing, and I would like to let people on the public Internet use the web server, I would need to set up port forwarding on the NAT router to let the public use the public, outside address to get to the private, inside address of the web server.

NAT translates an inside address to an outside address. Traffic destined for an inside private address cannot be routed on the internet. The public, outside address belongs to the NAT router. In the example above, traffic sent to the outside, public address of the router on port 80 (HTTP) would be dropped by the NAT router since it is not running a web server. When you configure port forwarding on the NAT router, then it knows to forward that traffic to a particular private, inside address.


I think this is a case of the same pair of words being used for two different things in two different contexts.

"port forwarding" in the context of NAT routers is a rule added to the NAT implementation such that incoming connections on a given external IP and port are mapped to a given internal IP and port (often but not always external and internal ports are the same).

"port forwarding" in the context of ssh is a system that forwards application-data from a TCP connection on the client side to a TCP connection on the server side over the ssh connection.

Unfortunately rather than making a clear distinction between the two meanings the wikipedia article you linked to confusingly mixes them up.

Your Answer

