2

I want to connect from source server S to my target server T. However connection to T is restricted to only from intermediate server I. Since S can't connect to T, I have created a ssh tunnel from S to T via I using:

ssh -N -f -L port:T:22 I

Now I can connect to T using:

ssh -p port user@localhost

But my problem is that I have to ping to the target T. How can I ping using tunneling.

gjois
  • 2,025
  • 3
  • 18
  • 19
  • 1
    Duplicate of http://stackoverflow.com/questions/4903002/can-i-use-http-tunnel-to-ping-or-traceroute-through-a-proxy-with-firewall – Barmar Dec 31 '13 at 02:30
  • That was the first result that showed up when I googled "ping through ssh tunnel". How did you miss it? – Barmar Dec 31 '13 at 02:31
  • @Barmer Saw that thread before posting here, but it needs curl and also I'm using this ping test in a script and that script at this time have only tunnel port number. So wanted to if I can ping using only port – gjois Dec 31 '13 at 02:42
  • But it answers your question: you can't ping through a tunnel. It uses `curl` to test the webserver _instead_ of pinging. You need to find some other way to test the server. – Barmar Dec 31 '13 at 02:47
  • Down voted. What was wrong in question? Down voters have to put a comment to show whats wrong in question – gjois Dec 31 '13 at 03:21
  • Maybe because it was posted to the wrong site, it's not a programming question. superuser.com is more appropriate. – Barmar Dec 31 '13 at 03:25

1 Answers1

7

You can't ping through a tunnel. SSH tunnels can only pass TCP connections, ping uses ICMP.

You could run ping on the intermediate server via SSH:

ssh I ping T
Barmar
  • 741,623
  • 53
  • 500
  • 612