Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to connect to my VPS via ssh. The output of ssh is the following:

"No route to host"

It seems, that it's because I'm located at a LAN and have no public IP. So, my question is, how can I "tell" the ssh that route? I have no access to other devices of my LAN, because it's not mine. Also, I have no access to VPS, because it's in another country.

UPDATE: also, the ping command to my VPS works perfect and gives a result of about 300ms.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Ping working seems to indicate you have a route to internet. If you are using the ping to your VPS using its IP and ssh with the hostname is not working, try using ssh with the IP too because it may be a DNS issue.

If ping is working with the public hostname of your VPS, ssh should work the same unless there is something (firewall or proxy) blocking outgoing connections on port 22 or there is a proxy in the LAN not configured to proxy port 22 transparently (only 80 probably). If this is the case, you may be able to use ssh defining the proxy settings for the ssh connection (if the server allows it) but without knowing more it is not easy to indicate a real solution if any.

EDIT after comments:

Seeing telnet on port 80 works and not on port 22, outgoing is probably blocked on port 22 (assuming your VPS ssh server is working and listening!). I think you have a few options:

  • talk to the admin of your Provider and see what he can do to open port 22
  • change the port your VPS ssh server is listening to a non blocked port
  • use the console of your VPS if available. Usually this is accessed from the website and with a java or ajax connecting console directly to your server.

Anyways, you'll have to connect using the 3rd option to be able to change the listening port for option 2 unless you can have your VPS provider to do this for you.

share|improve this answer
    
Thank for your answer! I'm using both ping and ssh on the IP of the VPS. How can I know whether there's some firewall blocking my requests? There's no firewall on my computer. –  Angstrem Oct 14 '12 at 16:33
    
So I think it is a firewall in the LAN (on the router probably). What kind of size/type is the LAN? (University, home, corporate, hotel?) –  laurent Oct 14 '12 at 16:37
    
It's a city-scale LAN, it serves as an internet (and also cable TV) provider in my city. –  Angstrem Oct 14 '12 at 16:39
    
You could try to telnet your VPS on different ports (where you know it will answer of course) just to see: telnet VPS_IP 22 for example. If it has a webserver on it try 80 and see if it works. –  laurent Oct 14 '12 at 16:40
    
Oh my god, something definitely blocks 22nd port... Telnet on 22 can't find the route while telnet on 80 can. Perhaps, I need to know somehow what ports are NOT blocked by my LAN and tell my VPS providers to set port forwarding for VPS... Or there are some easier ways? –  Angstrem Oct 14 '12 at 16:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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