We have existing SQL Connection strings like "tcp:aws.server.address,1433".
We can no longer connect to aws.server.address directly, and instead have to go through a jump server.
WITHOUT MODIFYING THE CONNECTION STRING, what do I have to do in Windows to make sure traffic targetting aws.server.address on port 1433 is actually forced to go through the local port (i.e. 5001) established through an SSH tunnel like this:
ssh -L 5001:aws.serveraddress:1433 [email protected]
I though I could just use netsh interface portproxy with a listenaddress,listenport equal to aws.server.address,1433 with a connectaddress,connectport of 127.0.0.1,5001, but that doesn't seem to work. It does not "listen" for connections targetting the remote server and does not "connect" them to the local port I specify.
I also tried using the -N option for the ssh command to not open any command session. Perhaps I have to do some trickery with routing tables or ip tables?
The whole goal here is to reroute traffic targeting aws.server.address,1433 through this tunnel, so I don't have to change all the connection strings to some local address and port. There has to be a way to do this.
For example: This basically a situation where I need to map a plurality of addresses.... all targeting a single port (1433) to a single address (localhost) targetting multiple ports (unique jump host connections for a particular server).
remoteAddressA:port1433 -> forwarded to -> localhost:port5001
remoteAddressB:port1433 -> forwarded to -> localhost:port5002
where locahost:port5001 is an shh tunnel through the jump server to remoteAddressA, and localhost:port5002 is another ssh tunnel through the jump server to remoteAddressB.