0

I have the following layout.

  • A (machine behind NAT/Firewall)
  • B (server for reverse ssh connections - bastion host?)
  • C (my laptop)

A forms a reverse ssh to B

/usr/bin/autossh -M 0 -N -q -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" -o "StrictHostKeyChecking=no" [email protected] -R 22000:localhost:22 -C -i ~/id_rsa

C forms an ssh connection to A through B (B is my jump host)

I do this using the following ssh config (.ssh/config)

Host B
    ForwardAgent yes
    HostName xxx.xxx.xxx.xxx
    IdentityFile ~/.ssh/b.id_rsa

Host A
    HostName 127.0.0.1
    ProxyJump B
    StrictHostKeyChecking no
    IdentityFile ~/.ssh/a.id_rsa
    Port 22000

At this point I can type ssh A and I get access as expected to the server terminal.

Now I would like to be able to tunnel a tool (example Robo T3) to connect from my local using port 27000 to the MongoDB installed on host A and listens to localhost:27017.

What should I add to my SSH command (or modify in the config) to achieve that?

1 Answer 1

0

Thanks to this post (How do I ssh tunnel port forward?) I managed to find the solution which is quite trivial.

ssh -N -L 27000:localhost:27017 A

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .