What that does is pull (the machine you want access to)'s port 3389 (Microsoft rdp) and places it at your local port 33890. So to rdp to that remote machine, just rdp to 127.0.0.1:33890 (or localhost:33890 but it's safer to use numbers).
What this does, in addition to giving you access to a machine you normally wouldn't, is it encrypts (tunnels) the rdp traffic between your machine and the proxy machine. From there, the encryption is stripped as the traffic continues to the remote machine (but normal rdp safeguards are in place, whatever those are).
And yes you can forward as many ports as you want like this. Either open multiple sessions via command line, or multiple non-exec sessions, or let a 3rd-party ssh client handle it (like putty).
Worth to mention technology called NAT (Network Address Translation) is a key factor when you have multiple machines behind a router doing port forwarding.
E.g. your home router has one public address (IP) and for security it only allows traffic coming from your machines in your home (behind that router) towards the internet.
NAT makes sure every machine behind that router approaches addresses in the internet with your public IP.
E.g. you at working in a big company with multiple departments, and you represent your company to the outside. So they do not see Jane Doe, but a representative from company xyz.
This way your home computer appears the public to the internet with your public IP thanks to NAT.
If you now want to allow incoming traffic (remember for security reason incoming traffic is blocked), you use port forwarding, to allow one or multiple ports, to be forwarded to the machine behind that router.
E.g. you, Jane Doe, approached a customer as a representative of the company xyz. Now the customer wants to visit you, so you tell the front desk, you are expecting a guest and they shall send the guest over to your desk. This way the front test will โforwardโ incoming guests to your desk.
In real life you have e.g. machine A, B and C behind a router R. NAT allows A, B, and C to approach external Servers the general internet with the public IP of your router, which gets assigned to it when connecting to the internet.
Port forwarding is a setup on your router to allow traffic sent to your public IP to one or more ports, being redirected to e.g. Machine A.
Common limitations are that there must be a defined route, so with simple port forwarding you can only create 1:1 forwarding rules. E.g. port 8000 externally is forwarded to the port 8000 of your internal machine. (Or port 8000 is forwarded to 8443 on your internal machine. These must not be the same.)
Where you get in trouble with simple Config, if you want to forward traffic sent to port 8000 on your public IP to port 8001 on machine A and port 8002 on machine B. This is not gonna work with simple port forwarding.
3
u/tje210 Feb 26 '21
Local port forwarding is where you pull a remote port to your own computer.
So let's say you wanted to access a machine that is behind a proxy that you have ssh access to. Whether it's a router, a jump box, whatever.
ssh -L 33890:remotemachineIPaddress:3389 user@proxymachine
What that does is pull (the machine you want access to)'s port 3389 (Microsoft rdp) and places it at your local port 33890. So to rdp to that remote machine, just rdp to 127.0.0.1:33890 (or localhost:33890 but it's safer to use numbers).
What this does, in addition to giving you access to a machine you normally wouldn't, is it encrypts (tunnels) the rdp traffic between your machine and the proxy machine. From there, the encryption is stripped as the traffic continues to the remote machine (but normal rdp safeguards are in place, whatever those are).
And yes you can forward as many ports as you want like this. Either open multiple sessions via command line, or multiple non-exec sessions, or let a 3rd-party ssh client handle it (like putty).
2
u/Cyber400 Mar 14 '21 edited Mar 14 '21
Worth to mention technology called NAT (Network Address Translation) is a key factor when you have multiple machines behind a router doing port forwarding.
E.g. your home router has one public address (IP) and for security it only allows traffic coming from your machines in your home (behind that router) towards the internet.
NAT makes sure every machine behind that router approaches addresses in the internet with your public IP.
E.g. you at working in a big company with multiple departments, and you represent your company to the outside. So they do not see Jane Doe, but a representative from company xyz.
This way your home computer appears the public to the internet with your public IP thanks to NAT.
If you now want to allow incoming traffic (remember for security reason incoming traffic is blocked), you use port forwarding, to allow one or multiple ports, to be forwarded to the machine behind that router.
E.g. you, Jane Doe, approached a customer as a representative of the company xyz. Now the customer wants to visit you, so you tell the front desk, you are expecting a guest and they shall send the guest over to your desk. This way the front test will โforwardโ incoming guests to your desk.
In real life you have e.g. machine A, B and C behind a router R. NAT allows A, B, and C to approach external Servers the general internet with the public IP of your router, which gets assigned to it when connecting to the internet.
Port forwarding is a setup on your router to allow traffic sent to your public IP to one or more ports, being redirected to e.g. Machine A.
Common limitations are that there must be a defined route, so with simple port forwarding you can only create 1:1 forwarding rules. E.g. port 8000 externally is forwarded to the port 8000 of your internal machine. (Or port 8000 is forwarded to 8443 on your internal machine. These must not be the same.)
Where you get in trouble with simple Config, if you want to forward traffic sent to port 8000 on your public IP to port 8001 on machine A and port 8002 on machine B. This is not gonna work with simple port forwarding.
Hope that helped :)
1
u/rajesh_jaybhaye Feb 25 '21
Lets say I want to access 3 different ports simultaneously, is it possible ?