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.
  1. machine1 IP: 172.30.11.119
  2. machine2 IP: 172.30.11.120
  3. machine3 IP: 172.30.11.121
  4. machine4 IP: 172.30.11.122

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.

set the default gateway as 172.30.11.97 in machine4(in order to reach it from user desktop via putty connection manager)

allow-hotplug eth0
 iface eth0 inet static
      address 172.30.11.122
      netmask 255.255.255.0
      gateway 172.30.11.97

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
              address 172.30.11.121
              netmask 255.255.255.0

      post-up ip rule add dev eth0 table policy_gw
      post-up ip route add default via 172.30.11.97 dev etho src 172.30.11.121/24 table policy_gw 

  Done like that for 120/119 machines.

now I can reach these machines directly via putty.

problem faced: I can 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 121 machine: ssh 172.30.11.120 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 122:

root@debian:~# route -n                                       
Kernel IP routing table 
Destination  Gateway      Genmask       Flags   Metric Ref Use Iface 
0.0.0.0      172.30.11.97 0.0.0.0       UG       0      0   0  eth1 
172.30.11.0  0.0.0.0      255.255.255.0 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 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. –  edvinas.me Apr 22 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 at 7:10
    
@lain : The machine IP configured with default gway IP 172.30.11.97 is a cisco switch/router . It has the port for SSH,telnet closed and ICMP port open. –  renga_incharge Apr 22 at 9:07
    
can you add the ssh command you are using ? –  kranteg Apr 22 at 20:28

1 Answer 1

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

 
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.