Let’s say an application connects to a host:port and does its thing. The host is configurable but not the port, it always connects to port 9991.
Also, you can’t connect directly to the destination hosts, but you can SSH to an intermediate host and create SSH tunnels, and then point the application to localhost instead of the real destination host:
L9991 -> 10.8.33.52:9991 L9992 -> 10.8.45.121:9991
Pointing the application to localhost:9991 will make it reach the first destination host, and pointing it to localhost:9992 will make it reach the other one. But the port is not configurable in this application, so it can’t use the second tunnel.
In this case you can use several of the multiple localhost addresses (127.0.0.0/8), and listen on the same port on all of them
L127.0.0.1:9991 -> 10.8.33.52:9991 L127.0.0.2:9991 -> 10.8.45.121:9991
And then point the application to 127.0.0.1:9991 or 127.0.0.2:9991
The listening program in this case would be Putty or ssh.exe, but it should work with any other program that supports specifying the IP address and port where to listen for connections. For example this is the way to specify it in Netcat:
nc -l 127.0.0.1 9991 nc -l 127.0.0.2 9991
Deja un comentario