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

druuna 03-12-2012 08:36 AM

Hi,

The server is reachable (nmap could get info from it) but no services seem to be listening. It could be that the service isn't running, is running on a none-standard port or a firewall is blocking something or the network isn't configured correctly or .....

Is the sshd service up and running:
- Did you execute the commands given in post #5 on the server you connect to? You should.

Firewall:
- guess not, you did run the iptables status commands on both boxes.
- A, for now, unknown firewall on the network?

Network:
- Are these real or virtual machines?
- Are they on the same network range?
(do you have a network admin that can look into this?)

Miscl:
- Is the server you want to ssh into OK?

cardiner 03-12-2012 08:41 AM

The things is, i was just thrown in this network and all servers were given to me, i assigment to make monitoring for all these systems were asignt to me, so i have no idea how these systems and netowk were configured and set up.. just basic knowlige. to what rpm packaged there tools route and ifconfig belong?

cardiner 03-12-2012 08:48 AM

Quote:

Originally Posted by druuna (Post 4624750)
Hi,

The server is reachable (nmap could get info from it) but no services seem to be listening. It could be that the service isn't running, is running on a none-standard port or a firewall is blocking something or the network isn't configured correctly or .....

Is the sshd service up and running:
- Did you execute the commands given in post #5 on the server you connect to? You should.

Firewall:
- guess not, you did run the iptables status commands on both boxes.

Network:
- Are these real or virtual machines?
- Are they on the same network range?
(do you have a network admin that can look into this?)

Miscl:
- Is the server you want to ssh into OK?

OK, i executed the command in post #5 and yeah on both servers iptables status was the same, they are real machines, and yeah they are on the same nwtwork range, and yeah server is allright, up and running i am actually connected to both of them from jump server, but i need to be able to connecto from one to another!

druuna 03-12-2012 08:58 AM

Hi,
Quote:

Originally Posted by cardiner (Post 4624755)
The things is, i was just thrown in this network and all servers were given to me, i assigment to make monitoring for all these systems were asignt to me, so i have no idea how these systems and netowk were configured and set up.. just basic knowlige.

Without knowledge about the set-up (network and machines) it will be all but impossible to solve this problem.

Quote:

to what rpm packaged there tools route and ifconfig belong?
Both are basic binaries and are installed already. The package they belong to: net-tools (yum provides */ifconfig).

I'm assuming based on the nmap command output that there is some sort of network related (firewall?) issue. Are you able to ssh the other way around (from Server2 to server1 instead of from Server1 to server2)?

cardiner 03-12-2012 09:02 AM

okey...soryy guys for all the trouble i put you through, but i just found out from my linux staff support that i need to order a firewall opening, so it was a firewall isue, anytway thx for your time...i actually learn things or two while trying to solve this :)

druuna 03-12-2012 09:16 AM

You're welcome :)

BTW: Can you put up the [SOLVED] tag.
first post -> Thread Tools -> Mark this thread as solved


All times are GMT -5. The time now is 06:20 PM.