6

My situation: I want to remotely debug my c++ application with gdbserver and eclipse. Eclipse is running on my local workstation (in the 192.168.0.0 network) and gdbserver is running on a clustermachine in the 10.0.0.0 network. I have ssh access to the clustermachine via a machine that is in both networks.

How can I set up a tunnel so that my eclipse can access the gdbserver? I don't have administrator rights/root/sudo access.

All the machines are linux/Unix with openssh.

2 Answers 2

8

I trust you can already SSH to a system on the remote private network (10.0.0.0). If your local system is running openssh, add to your $HOME/.ssh/config:

Host gatewaymachine
  LocalForward 12080 remote_ip:portnum

Where 'remote_ip' is the IP address of the remote clustermachine system where gdbserver runs, and portnum is the port that it listens on. SSH to gatewaymachine, then connect your application to localhost, port 12080. For example if this is a web application

http://localhost:12080

If you're not using a web application, you'll need to set up your connection information to reflect that you're going to 'localhost' port '12080' (or whatever port you like, see below).

Instead of editing your ssh config, you can also use ssh command parameters:

ssh -L 12080:remote_ip:portnum gatewaymachine

(change 12080 to whatever port you want above 1024; below 1024 and you'll need root access to bind to the port)

2
  • I can not directly ssh to clustermachine. Only via gatewaymachine. How can I incorporate that extra step?
    – Peter Smit
    Jul 9, 2009 at 7:54
  • edited my answer, s/clustermachine/gatewaymachine/, and remember that remote_ip will be the IP of the clustermachine where your app is running and listening on 'portnum'
    – jtimberman
    Jul 9, 2009 at 8:25
1

Basically, what jtimberman said :). You might want to look into autossh if you have trouble keeping your tunnel up for extended periods of time.

You must log in to answer this question.

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