Skip to content

Instantly share code, notes, and snippets.

@hoto
Created July 30, 2018 10:34
Show Gist options
  • Save hoto/4143b1051a931ae51b1132904a8e70e1 to your computer and use it in GitHub Desktop.
Save hoto/4143b1051a931ae51b1132904a8e70e1 to your computer and use it in GitHub Desktop.

Local port forwarding through a bastion machine:

One line version:

ssh -i ~/.ssh/bastion-key.pem -N -L 9000:db.mycompany.com:1521 [email protected]

Or run with -v to debug:

ssh -v -i ~/.ssh/bastion-key.pem -N -L 9000:db.mycompany.com:1521 [email protected]

Db should be accessible on localhost:9000 From another terminal run: telnet localhost 9000 <- this does not prove the connection to the DB unfortunately, need to check by connecting to the db with dedicated app or jdbc

In debug mode I have:


# and after using telnet
Connection to port 9000 forwarding to bd.db.mycompany.com port 1521 requested.```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment