Pentesting Prereqs: Data Exfiltration Lab ports question

Hello! I am not understanding outbound ports. Do outgoing and incoming port numbers match? The lab says if I can connect from the IP I remotedesktop’d into to the Python server on my machine, then that remote port is allowed outbound connectivity. So does that mean if I’m in the remote machine and I type in my kali machine’s tap0 IP plus the port I opened, that same port number is allowed outbound connections within the remote machine?

Outbound ports do not need to be allowed inbound. However if you are in a machine, and make a connection back to your machine that you are attacking with, then yes you have an outbound and inbound connection. Also the port does not have to be the same, usually on your computer you make a random port address, something like 50102, from there that port goes to 80 or 443, ort whatever else. This happens at the router, so the router uses a NAT table to put the outbound public IP to the proper inbound connection.

If you are able to connect to the machine you are inside the machine.

Thank you for the help!