Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
  1. machine1 IP:
  2. machine2 IP:
  3. machine3 IP:
  4. machine4 IP:

Note: These machines are connected to LAN.

I have configured the static IP for Ethernet interface of each machine as in above in /etc/network/interfaces file in order to persist the IP even after system reboot.

I have set the default gateway as in machine 4 (in order to reach it from user desktop via putty connection manager)

allow-hotplug eth0
 iface eth0 inet static

But in other 3 machines I didn't set the default gateway as done for 122. Instead I tried policy routing in those 3 machines like below in the "interfaces" and "rt_table" file:

 echo "1 policy_gw" >> /etc/iproute/rt_table
    In /etc/iproute/rt_table:
      1 policy_gw

In /etc/network/interfaces:

      allow-hotplug eth0
      iface eth0 inet static

      post-up ip rule add dev eth0 table policy_gw
      post-up ip route add default via dev etho src table policy_gw 

Done like that for 120/119 machines. Now I can reach these machines directly via putty.

Problem faced: I am able to ping every machine in this LAN from some other machine in the same LAN. But ssh is failing with the error port 22: no route to host

Suppose if I am in machine 121 : ssh is throwing the above error.

default gateway is a cisco system router/switch.They are blocking ports for SSH,telnet protocols but not ICMP.

Routing table of machine 122:

root@debian:~# route -n                                       
Kernel IP routing table 
Destination  Gateway      Genmask       Flags   Metric Ref Use Iface       UG       0      0   0  eth1 U        0      0   0  eth1

Contents of ssh_config file:

Host *
    SendEnv LANG LC_*
    HashKnownHosts yes
    GSSAPIAuthentication yes
    GSSAPIDelegateCredentials no
share|improve this question
What does this mean ? They are blocking ports for SSH,telnet protocols but not ICMP. – Iain Apr 22 '14 at 7:01
Well there is nothing you can do, I don't think you can run SSH through ICMP, so you will need a port unblocked. – phoops Apr 22 '14 at 7:09
Does your server have ipv6 enabled? (If it were a firewall issue, you shouldn't get "no route to host".) – Jenny D Apr 22 '14 at 7:10
@lain : The machine IP configured with default gway IP is a cisco switch/router . It has the port for SSH,telnet closed and ICMP port open. – renga_incharge Apr 22 '14 at 9:07
can you add the ssh command you are using ? – kranteg Apr 22 '14 at 20:28

Does you hosts located in the same physical network?

"no route to host" - it seems to be an icmp answer from your router, your can test it with network analyzer. It seems your ssh traffic goes via router, despite hosts are located in the same network, maybe your policy_gw table have higher priority, than builtin table local. Router refuses to forward it (but in the same time it allows icmp somehow) or it really have no route to destination. See your router's tables or correct your policy routing for your hosts talk directly, as they should.

share|improve this answer

Your Answer


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.