I'm trying to SSH tunnel hop to a Tomcat7 server where JMX was configured on port 9090.
localhost > hostB > hostC.
In a terminal, from localhost to hostB:
ssh -L 8989:localhost:8989 me@hostB
Once connected to hostB, I'll enter the following command to connect to hostC:
sudo -u userA ssh userB@hostC -i /path/to/key -p 21559 -L 8989:localhost:9090
In VisualVM, I attempt to connect to localhost:8989 but get
"Cannot connect to localhost:8989 using service:jmx:rmi...".
The configuration of Tomcat/JMX is the same as the other servers located inside the firewall. Those were previously confirmed accessible with VisualVM.
All commands work without the forwarding of ports. I'm able to interact with hostC without any issues. I simply cannot tunnel at this point.
Using netstat from hostC:
[userB@hostC ~]$ netstat -an | grep 8989 [userB@hostC ~]$ netstat -an | grep 9090 tcp 0 0 :::9090 :::* LISTEN
With a terminal looking like this:
In another terminal, I entered the following:
telnet localhost 8989 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'
Seems like it's connected?