Custom Search



Finally, after some tinkering and trial and error.. I finally made an SSH tunnel for JProfiler between NAT networks to work.. \:D/

Here’s the scenario. We have a remote server where a java based web application runs and we want to monitor the said application using JProfiler to test it for memory leaks.

I am now facing the following challenges:

1. We have no root access to the server.
2. We have no administrative rights to the network and firewall, thus we can’t open and close access ports at will.
3. The server is behind a firewall and access to it is only done through NAT.

Here are the only things I have:

1. SSH access to the remote server using a normal user account.
2. Read/Write permission to the application server files.
3. A cup of coffee and a pack of cigarette. Hehehehe! :D

The remote server have an internal IP, let’s say 192.168.128.7 and it can be accessed from the outside using a NAT external IP, like 203.192.28.31. So the problem now is, how can I open up a port in the remote server where the JProfiler server integration script would listen for connection and in turn connect my JProfiler program through it? Well how else, through a SSH tunnel of course! :D

I tried running the following SSH tunnel command from one of my Solaris test servers (using the default JProfiler port 8849) :

ssh -g -N -L 8849:203.192.28.31:8849 [email protected]

This should be the normal setup in which my test server should establish a SSH connection to the remote server, listen to port 8849 and then forward any connections to it to port 8849 of the remote server using the SSH tunnel.

For some reason this doesn’t seem to work, but for HTTP ports (80) and other access ports it seems to work but for JProfiler even if I don’t use default port 8849, the remote server doesn’t seem to receive the forwarded request. The only culprit I can think of here is the NAT setup of the remote server.

After much thinking, I came up with the idea that instead of using the external NAT IP of the remote server in ssh forwarding, I would just use the internal IP and just use the external IP to connect the test server to the remote server through SSH. Here’s the command I used:

ssh -g -N -L 8849:192.168.128.7:8849 [email protected]

Walaaah! It worked and I was able to connect. \:D/

I guess…the coffee and pack of cigarette did the trick .. :))

Popularity: 7% [?]

6 Responses to “JProfiler, SSH Tunnel, and NAT Networks”

  1. Deepak Agarawl Says:

    Hi, I am using Jprofiler 5.1.2. where to put that ‘ssh -g -N -L 8849:192.168.128.7:8849 [email protected]‘ command in Jprofiler so that jprofiler can connect to the remote server?

  2. HyperAxe Says:

    If you are using Linux then you can just open up a console and input the SSH tunnel command. On windows you can use Putty to create the tunnel.

    Hope this helps. :)

  3. Deepak Agarwal Says:

    I am aware of that I can use console to use ssh. what I want to know that how to tell JProfiler to use that ssh command while connection to the remote server.
    Am I not clear?
    Means…. I am using windows xp and running JProfiler on it , now I want Jprofiler to do some profiling on a application running on a remote server ( and this server is behind the firewall), so there must be some place in JProfiler where I can use SSH command…
    If Still I am not clear please let me know, as I am really lookin for the solution of my problem

  4. HyperAxe Says:

    I get your point. I really don’t know if JProfiler would allow you to fire up external system commands during testing, or at least I haven’t tried that one yet. So I can’t help you at this point. Sorry. :(

  5. Deepak Agarwal Says:

    :(.
    Anyways thanks for the reply , and I wish you get 2 packets of cigrette and 2 cup of coffee this time and find the solution :)

  6. HyperAxe Says:

    Hahahahha! That might do the trick. :))

    Don’t worry, I’ll try to check on this during some free time and let you know as soon as I find out something. ;)

Leave a Reply

Get Adobe Flash playerPlugin by wpburn.com wordpress themes