3

Port Forwarding as I understand it

When creating a port forwarding rule, the router keeps the specified external port open at all times, and simply forwards all inbound traffic for that port to the endpoint (private IP and port) given in the rule.

As an example, when I create the following rule...

External Port: TCP 3478
IP: 192.168.1.100
Internal Port: TCP 3478

...the router now will forward all inbound traffic on external port TCP 3478 to the endpoint at 192.168.1.100:3478.

Port Triggering as I understand it

With port triggering, the rule structure is identical to port forwarding (i.e. internal port, external port, IP, etc.), but every definition I've come across seems to say that these ports are only "triggered" when an outbound request is sent from the internal port designated in the rule. <= This is where I get confused.

I thought services (are supposed to) use randomly chosen ports from the ephemeral range, thus the actual source/internal port is highly unlikely to be whatever internal port is configured in the rule. So assuming my understanding to this point is correct, how does port triggering actually determine the correct ports to open?

I'm still learning about TCP/IP, NAT, and networking in general, so feel free to correct my terminology and anything else I may have wrong.

1
  • 1
    I had not. Admittedly, I usually avoid Wikipedia due to the unverifiable nature of information on there. I seem to have played myself this round. Thank you for swift answer, friend!
    – Cyber
    Dec 28, 2019 at 22:08

1 Answer 1

6

This is how it works when everything is set up well:

  1. A computer in your LAN initiates a connection to some server. It uses the address of the server and some port it expects the server to listen on. This is a "fixed" port, i.e. a particular software (daemon, game server etc.) "always" listens on this port, this address; nothing is random on this end of the connection.
  2. A random(-ish) ephemeral port is used on the local side (on the initiating computer, on the router after NAT), but what triggers the forwarding is the specific port (and maybe the address) used for the remote end of the connection.
  3. Now if the same server initiates an incoming connection (that would otherwise be rejected by the router because there is no regular port forwarding) then the router will forward the connection to the computer that initiated the first (outgoing) connection.

So the rule is like

  • if A from LAN initiates a connection to port X of specific/any remote (WAN) server and the server tries to initiate another (incoming) connection on port Y then forward the latter connection to A.
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .