LinuxQuestions.org

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

cardiner 03-12-2012 07:19 AM

ssh connection timed out...
 
Hello, i stumbled on a little problem today...

in few words I have 2 RH5 machines, i need to connect from one machine to another using ssh..everything is fine until i try to do it :D

When i am tryting to ssh user@host, i get after about minute connection timed out. The RSA key auterized keys are configured. entried in host file are added.

When i try to ping the host to which i am trying to connect everything seems to be fine. so i am trying to telnet ip port, says trying ip, then times out. OK i tracetour -n ip, and that is the place where i stack.

the out put is

traceroute -n 10.254.50.10
traceroute to 10.254.50.10 (10.254.50.10), 30 hops max, 40 byte packets
1 10.254.49.65 1.080 ms 0.999 ms 0.998 ms
2 10.255.145.122 1.279 ms 1.271 ms 1.248 ms
3 * * *
4 * * *
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 * * *

i actually dont know how it should look like, maybe some one could help. but still i cant connect.

hurryi 03-12-2012 07:24 AM

Hello,

is sshd running on the destination machine?
is it listening on the port where you try to connect? (default 22)
is firewall enabled? if yes is it allows connection?

cardiner 03-12-2012 07:33 AM

Okey, i checked and sshd is running, but how can i see if it listening, and if he is listening then what ports??

and i know that firewall is not enabled, because there is no need of it, its internal servers ;)

thx in advance!

hurryi 03-12-2012 07:37 AM

to see on which interface(s) and on port the sshd listening
netstat -tpln | grep ssh

druuna 03-12-2012 07:38 AM

Hi,
Quote:

Originally Posted by cardiner (Post 4624694)
how can i see if sshd running

Here are 2 ways:
Code:

service sshd status
ps -ef | grep sshd

Quote:

how can i see if it listening, and if he is listening then what ports??
Sshd listens, by default, on port 22. Here's one way using netstat:
Code:

netstat -plan | grep sshd
Quote:

and i know that firewall is not enabled, because there is no need of it, its internal servers ;)thx in advance!
Did you actually turn the firewall off?

Hope this helps.

cardiner 03-12-2012 07:42 AM

Okey its runing and listneing the posrt 22, but i may have spoken to realy about firewall, because i did not turn it off and i just assumed why would it be set up if its iternal server, but i probably should check if firewall is up, right? so question is how? and how can i check if firewall is blocking incoming connection?

hurryi 03-12-2012 07:44 AM

/etc/init.d/iptables status

will show you if it is running or not

cardiner 03-12-2012 07:46 AM

the outpoot is like

Quote:

Chain INPUT (policy ACCEPT)
num target prot opt source destination

Chain FORWARD (policy ACCEPT)
num target prot opt source destination

Chain OUTPUT (policy ACCEPT)
num target prot opt source destination
and i checked it with
Quote:

netstat -nat | grep :22
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
so i guess its fine...so where to next?

druuna 03-12-2012 07:57 AM

Hi,

what is the output of the following commands (as root user):
Code:

# ssh with verbose output:
$ ssh -v user@host

# is host present in /etc/hosts file:
$ grep host /etc/hosts

# iptables seems not to be running, just in case:
$ service iptables status

Substitute user and host with proper values (don't use root as user....).

hurryi 03-12-2012 08:02 AM

is there any network device between the 2 systems which could block access? (router, etc)

also you mentioned you can ping the system
is there any other service(open port), where you are able to connect? for eg httpd(tcp 80)

if it is allowed you can use port scanner tool like "nmap" to check it

cardiner 03-12-2012 08:03 AM

so the out poot of first command is
Quote:

[root@tlnpatl07 etc]# ssh -v cacti@tlnpamt01.gi.telenor.com
OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to tlnpamt01.gi.telenor.com [10.254.50.10] port 22.
debug1: connect to address 10.254.50.10 port 22: Connection timed out
ssh: connect to host tlnpamt01.gi.telenor.com port 22: Connection timed out

and yeah host is added in host file, and out put of third script

Quote:

Table: filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination

Chain FORWARD (policy ACCEPT)
num target prot opt source destination

Chain OUTPUT (policy ACCEPT)
num target prot opt source destination

cardiner 03-12-2012 08:08 AM

Quote:

Originally Posted by hurryi (Post 4624720)
is there any network device between the 2 systems which could block access? (router, etc)

also you mentioned you can ping the system
is there any other service(open port), where you are able to connect? for eg httpd(tcp 80)

if it is allowed you can use port scanner tool like "nmap" to check it

how can i check if there are devices between thous 2 machines?
did not quite understood that about other services, sorry!

druuna 03-12-2012 08:17 AM

Hi,

Which host did you run the service iptables status command? On both servers I hope.....

What is the output of the following command (as root, from the server you ssh from):
Code:

nmap tlnpamt01.gi.telenor.com

cardiner 03-12-2012 08:24 AM

yeah on both servers

and output of that command is

Quote:

All 1680 scanned ports on tlnpamt01.gi.telenor.com (10.254.50.10) are filtered

Nmap finished: 1 IP address (1 host up) scanned in 35.391 seconds
hmm, does that mean there is not an open port on server i am trying to connect?

because i tried to another servers and it showed me There is interesting ports 22/tcp open ssh!

hurryi 03-12-2012 08:31 AM

Quote:

Originally Posted by cardiner (Post 4624728)
how can i check if there are devices between thous 2 machines?
did not quite understood that about other services, sorry!

well if you are asking this thats probably means you are not the network administrator there :)
you should contact them

about other services, i just wanted to see if other ports can be seen open or all of them filtered
most likely it is firewall issue somewhere as ping(icmp) worked for you, that means network connection is possible (of course if you pinged the right ip ^^)

how many interfaces the systems has?
ifconfig - will show you the active interfaces

route -n - will show you the routing table used by the system
you should then know which interface and then which gateway is used
who is responsible/can access that gateway?

so if you are only responsible for the 2 hosts you will need network admin assistance i believe


All times are GMT -5. The time now is 07:45 PM.