Score:1

ssh port forward connects to bastion instead of remote server

bh flag

I am facing an issue when I try to connect to remote machine (which is behind bastion host) via ssh local port forwarding. I am looking for the connection flow: my laptop --> Bastion host --> Remote server.

The command I use is: ssh -L local port:remote server:remote port username@bastionhost:bastionport

The above command works but I am connected to bastion host instead of remote server. I did check that settings allow TCP forwarding is allowed on bastion. What am I missing here if I want to connect to remote server

ws flag
It would help if you showed us the command you really ran - by all means change the names of the hosts. BTW if you enclose the paragraph in triple back quotes (ascii 96) then it will be easier to read / no additional markdown formatting will be applied).
nischeruku avatar
bh flag
ssh -L 1234:10.0.0.43:22 -i test1 -p 34627 [email protected]. This is the command I am running. "10.0.0.43" is my remote server while "xx.xx.xx.xx" is my bastion host
Score:0
fr flag

You are probably looking for -J option of ssh:

ssh -J username@bastionhost:bastionport <remote_server>:<remote_port>

You can also use ProxyJump configuration directive in Host section for your <remote_server>.

nischeruku avatar
bh flag
-J directive works if I set password authentication to yes. But I see the error "Permission denied (publickey). kex_exchange_identification: Connection closed by remote host" if I turn off password authentication
fr flag
You probably are using two different keys for both hosts. Try to add them in the config file in appropriate `Host` sections.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.