LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   ssh port 22 connection timed out (https://www.linuxquestions.org/questions/linux-newbie-8/ssh-port-22-connection-timed-out-870072/)

dev21082 03-21-2011 04:26 PM

ssh port 22 connection timed out
 
hii

i have two PCs A and B, both are connected via LAN

PC A Configuration is

IP Address 10.102.6.232
Broadcast Address 10.102.6.255
Subnet Mask 255.255.255.0
Default Route 10.102.6.2
Primary DNS 144.16.192.55

PC B Configuration is

IP Address 144.16.205.236
Broadcast Address 144.16.255.255
Subnet Mask 255.255.0.0
Default Route 144.16.204.1
Primary DNS 144.16.192.55

I am trying to connect B from A using command shh -X devendra@144.16.205.236, and facing error like ssh port 22 connection timed out.

help me out Plz .... thankyou

kbp 03-21-2011 04:35 PM

Sounds like there's a firewall between the two machines, if the sshd service wasn't running you should receive a "connect failed" message as opposed to a timeout. It's also possible that the target machine can't perform a reverse lookup on the source machines IP address but usually that would slow down the initial connection not prevent it completely.

Can you ssh into the server from another machine ok ?

cheers

Noway2 03-21-2011 06:25 PM

These machines are on different LAN segments, apparently with at least one router between them. Also, your PC B is using what is a public IP range, but you mention it being a LAN. Are you sure that your configuration is valid? In other words is either a public facing machine and this address has been assigned to you (you can't just pick your own) or do you have it fully isolated?

Are you able to ping from one machine to the other? I would verify this before working on SSH. Then you can run nmap to verify that the appropriate port is open on the target end.

dev21082 03-22-2011 03:05 AM

Thank you for reply

I am able to run "ping 144.16.205.236" output is like

64 bytes from 144.16.205.236: icmp_seq=1 ttl=60 time=0.560 ms
64 bytes from 144.16.205.236: icmp_seq=2 ttl=60 time=0.546 ms
64 bytes from 144.16.205.236: icmp_seq=3 ttl=60 time=0.556 ms

exactly i do not know how to use nmap to verify the appropriate port is open or not, but i tried this command


"sudo nmap -sU 127.0.0.1" where 127.0.0.1 is the host for both system
its giving

Interesting ports on localhost (127.0.0.1):
Not shown: 997 closed ports
PORT STATE SERVICE
137/udp open|filtered netbios-ns
138/udp open|filtered netbios-dgm
5353/udp open|filtered zeroconf

linuxgurusa 03-22-2011 03:53 AM

HI There DEV21082

OK, you need to understand what the guys are saying or asking:

Firstly, you have 2 different networks you are asking about.

Network 1 = 10.102.6.0/24
Network 2 = 144.16.0.0/16

You want to connect FROM network 1 TO Network 2 machine ? (From IP 10.102.6.232) TO IP (144.16.205.236)

Please do following command FROM machine 10.102.6.232

telnet 144.16.205.236 22

You must get a reply like

SSH-2.0-OpenSSH_5.4 or what ever version, does not matter what version.

If you get connection timed out or can't connect, please do following command FROM machine 10.102.6.232

traceroute -n 144.16.205.236 if Linux machine
tracert -d 144.16.205.236 if Windows machine

Give us answer please

dev21082 03-22-2011 07:59 AM

hello sir, thank u for reply

the problem is same as you are saying. i tried the command "telnet 144.16.205.236 22" and result was like "telnet: Unable to connect to remote host: Network is unreachable".

after that i tried the command "traceroute -n 144.16.205.236" and got the result as "traceroute: icmp socket: Operation not permitted". what it's mean ?

Noway2 03-22-2011 08:24 AM

Quote:

"traceroute: icmp socket: Operation not permitted"
This sounds like a permissions problem. Did you try running this command with sudo?

Quote:

"telnet: Unable to connect to remote host: Network is unreachable".
You have a routing problem where traffic can't get from one host to the other. What is the physical organization of your LAN? In other words, can you describe the connection between these two machines? For example: host A <------> switch <-----> host B.

dev21082 03-22-2011 01:41 PM

thank u for reply

sorry i could not tried with sudo but when i am trying "sudo traceroute -n 144.16.205.236" it is coming like

traceroute to 144.16.205.236 (144.16.205.236), 64 hops max, 40 byte packets
1 10.102.6.2 0 ms 0 ms 0 ms
2 10.200.31.1 1 ms 0 ms 0 ms
3 10.200.8.1 1 ms 1 ms 0 ms
4 10.154.1.1 1 ms 1 ms 1 ms
5 144.16.205.236 1 ms !C 1 ms !C 1 ms !C

sir i am new user for ubuntu 9.10. i am not understanding by the means of "host A <------> switch <-----> host B."

linuxgurusa 03-23-2011 03:15 AM

Quote:

Originally Posted by dev21082 (Post 4299522)
thank u for reply

sorry i could not tried with sudo but when i am trying "sudo traceroute -n 144.16.205.236" it is coming like

traceroute to 144.16.205.236 (144.16.205.236), 64 hops max, 40 byte packets
1 10.102.6.2 0 ms 0 ms 0 ms
2 10.200.31.1 1 ms 0 ms 0 ms
3 10.200.8.1 1 ms 1 ms 0 ms
4 10.154.1.1 1 ms 1 ms 1 ms
5 144.16.205.236 1 ms !C 1 ms !C 1 ms !C

sir i am new user for ubuntu 9.10. i am not understanding by the means of "host A <------> switch <-----> host B."

Thank you for the info buddy... OK, let's see now ..

It seems like the host you are connecting to (144.16.205.236) is actually on a WAN connection away from you. The "problem" now is, do you have access to firewall rules between you (10.102.6.232) and the HOSTB (144.16.205.236)??

There seems to be a route between you and HOSTB, but I can see there might be some ICMP filtering(firewall) as well.
Maybe if you have access to HOSTB (144.16.205.236), can you run command:

/sbin/iptables -L -n

Send us output please? Maybe there is no rule that will allow you access, or maybe there is a rule to allow your IP address (10.102.6.232) but you are actually connecting via NAT ip address (10.102.6.2) or something.

SO, please send us output of : /sbin/iptables -L -n on server 144.16.205.236 and we help from there !!

kingston 03-23-2011 06:25 AM

yeah. I faced the same kind of problem, and it was the external firewall which is blocking one of my network from communicating with another.
And also check the firewall,iptables configurations in both the (network) systems

Noway2 03-23-2011 11:44 AM

My suspicion is that 10.102.6.2 is the ip address assigned to the OP and that they are using DSL or some other form of internet access where they are behind a private proxy net of the ISP. Chances are that port 22, and others, are deliberately blocked.

dev21082 03-24-2011 02:12 AM

dear sir, thank u for help

I am the root user for both HOSTA (10.102.6.232) and HOSTB (144.16.205.236), but i don't know how to access firewall rules between them.

I tried command "/sbin/iptables -L -n" on HOSTB (144.16.205.236), it is coming like

Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
target prot opt source destination
REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
target prot opt source destination



and i also tried the command "/sbin/iptables -L -n" on HOSTA (10.102.6.232), it is coming like

Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

linuxgurusa 03-24-2011 04:49 AM

Quote:

Originally Posted by dev21082 (Post 4301374)
dear sir, thank u for help

I am the root user for both HOSTA (10.102.6.232) and HOSTB (144.16.205.236), but i don't know how to access firewall rules between them.

I tried command "/sbin/iptables -L -n" on HOSTB (144.16.205.236), it is coming like

Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
target prot opt source destination
REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
target prot opt source destination



and i also tried the command "/sbin/iptables -L -n" on HOSTA (10.102.6.232), it is coming like

Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Thank you for info, I can see there is no rule blocking it, but I suspect that you might have internal routing issues.

Please do following commands on each HOSTA and HOSTB and give feedback

From HOSTA(10.102.6.232): traceroute -n 144.16.205.236
From HOSTB(144.16.205.236): traceroute -n 10.102.6.232

Noway2 03-24-2011 07:40 AM

I have another question I would like to add to this. Do you know what these IP addresses are?
Code:

10.200.31.1, 10.200.8.1, 10.154.1.1
They appeared between your two hosts last time you performed a traceroute. Given that the last octet is .1 on each of them, my guess is that they are routers. What are the subnet masks of your two hosts (10.102.6.2 and 144.16.205.236)? You might also try switching from port 22 to a random, higher numbered port like 8228 or something to rule out port 22 being blocked.

k.kshitij 07-15-2013 08:30 AM

Hi All,
I'm facing the same problem, I'm connected to a amazon server (via ssh) from my machine and want to transfer files from my machine (ip:192.168.0.100) to amazon server (ip:172.31.9.192).

I ran traceroute -n 192.168.0.100 on amazon server following are the results
1 ec2-50-112-0-180.us-west-2.compute.amazonaws.com (50.112.0.180) 0.539 ms 0.744 ms 0.722 ms
2 205.251.232.224 (205.251.232.224) 1.595 ms 1.820 ms 1.796 ms
3 205.251.232.206 (205.251.232.206) 1.573 ms 1.762 ms 1.736 ms
4 205.251.232.102 (205.251.232.102) 7.608 ms 205.251.232.100 (205.251.232.100) 7.321 ms 205.251.232.73 (205.251.232.73) 7.271 ms
5 205.251.225.21 (205.251.225.21) 7.264 ms 205.251.225.197 (205.251.225.197) 7.654 ms 205.251.225.161 (205.251.225.161) 7.089 ms
6 tuk-edge-14.inet.qwest.net (65.122.235.177) 7.788 ms !N 65-122-235-173.dia.static.qwest.net (65.122.235.173) 21.671 ms !N tuk-edge-13.inet.qwest.net (65.122.235.169) 7.642 ms !N

Then is ran traceroute -n 172.31.9.192 on my local machine and got the following message.




1 192.168.0.1 1.237 ms 1.525 ms 1.799 ms
2 203.187.209.1 55.601 ms 55.654 ms 57.704 ms
3 * * *
4 203.109.71.73 144.309 ms 157.189 ms 157.662 ms
5 * * *
6 * * *
7 * * *
8 * * *
9 * * *
10 * * *
11 * * *
12 * * *
13 * * *
14 * * *
15 * * *
16 * * *
17 * * *
18 * * *
19 * * *
20 * * *
21 * * *
22 * * *
23 * * *
24 * * *
25 * * *
26 * * *
27 * * *
28 * * *
29 * * *
30 * *^C
I dont know what is the issue and why I'm not able to transfer the files to the amazon server when I'm getting connected to it.
Any help in this regards is appreciated.


All times are GMT -5. The time now is 01:00 AM.