0

I am trying to make a ssh tunnel connection to a remote server that has different SSH port.

My PC

hostname: fooserver.com

IP address: 10.25.0.186

SSH port: 63354

My Remote PC

hostname: barserver.com

IP address: 10.26.0.183

SSH port: 63354

Now I want to connect in my Remote PC's MySQL server by using "localhost" by doing the SSH tunnel command below.

ssh -L 3306:localhost:3306 root@barserver.com

But after issuing the command above it show an error after few moments.

connect to host barserver.com port 22: Network is unreachable

It's very obvious that my PC tries to connect to SSH standard port but remote PC is running its SSH port to 63354. How can set the ssh port in the ssh tunnel command

I tried the following below.

ssh -L 3306:localhost:3306 root@barserver.com:63354

but it says its an invalid hostname.

migrated from serverfault.com Apr 14 '16 at 15:52

This question came from our site for system and network administrators.

  • 1
    Try ssh -L 3306:localhost:3306 -p 63354 root@barserver.com. – MadHatter Apr 14 '16 at 15:45
  • hello @MadHatter Please post your answer :) you got it right :) – Olga Real Apr 14 '16 at 15:47
  • 1
    Honestly, whilst I like acceptance points as much as the next chap, it really doesn't deserve a Server Fault question. If you are grateful for the help, the best thing you can do is to please just delete this question, or flag a moderator and ask for it to be moved to SU, or to unix.SE. – MadHatter Apr 14 '16 at 15:48
  • Why i got a downvote? – Olga Real Apr 14 '16 at 15:48
  • Mouse over the down arrow; the popup says "This question does not show any research effort; it is unclear or not useful". Downvotes without comment may be presumed to be for at least one of those reasons. – MadHatter Apr 14 '16 at 15:49
2

Try ssh -L 3306:localhost:3306 -p 63354 root@barserver.com

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.