2

So, I have a server and a home machine. My server can't talk to internet, but my home machine can. So, I set up a reverse tunnel through home to server using:

ssh -R 9001:www.google.com:80 server

Now, when I try to ping from server, it says unknown host.

ping locahost:9001

Any idea what am I doing wrong?

2

ping is implemented in the ICMP protocol, the ports that you forward are TCP ports. So ping is not the appropriate test for this situation, you'd rather have to test with telnet or something similar to check if the connection can be established.

1

SSH tunnels don't work like that - the specifically forward tcp traffic on a set port to a specified address and port on the remote end of the tunnel. When you ping you actually use a different protocol called ICMP (Internet Control Message Protocol) on most systems (some use udp) which will not be passed over your ssh tunnel.

For your specific needs you would probably be better off with a VPN to your home machine. Then you can redirect the traffic with routes to your local machine. This will then allow you to send any IP related protocols (including udp, tcp and icmp), so you can ping, browse and so forth.

This would be quite a task for large organisations like google, because for every host you want to route to your home machine requires a route to be added to the server to handle this (and google has many IPs you will have to route). This is even the case for google if you were to route summarized netblocks of gooogle.

If you are willing to sacrifice your default route on your server (which would allow you to pass all non-local traffic over the VPN for routing), and use static routes on your server for any hosts on the server network then the task is much easier, because then it's just a case of IP forwarding. You point the default route to your VPN end point, and let IP forwarding on your home machine send the traffic out to the internet.

If you only want to redirect web traffic (HTTP/HTTPS) then you could use a reverse ssh tunnel in conjunction with a web proxy. This is fairly trivial as web clients provide an easy mechanism to point at the proxy.

You could also attempt to set up a SOCKS proxy (which is similar to a web proxy, but supports some other applications/protocols), but then only the applications on the server that utilize SOCKS could make use of it.

  • Thanks for the explanation. I actually want to access internet through reverse tunneling, looks like I need to look into the proxy angle! – user46026 Aug 28 '13 at 11:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.