LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 11-22-2006, 08:24 AM   #1
yumener
Member
 
Registered: Oct 2005
Posts: 63

Rep: Reputation: 15
can ping but not ssh


HI, I have two computers in the same internal network,
say A and B. I can ssh from A to B, but B can not
ssh to A. Ping command works very well. openssh was
installed on both computers. what are the other possible
reasons? another hint is A can ssh to itself which
means its ssh server is open as i think.

thanks
 
Old 11-22-2006, 08:33 AM   #2
camorri
LQ 5k Club
 
Registered: Nov 2002
Location: Somewhere inside 9.9 million sq. km. Canada
Distribution: Slackware 15.0, current, slackware-arm-currnet
Posts: 6,229

Rep: Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849
Have you got a firewall running? Are you using port 22 for sshd on the failing machine?
Could you post the error messages you get?
 
Old 11-22-2006, 09:14 AM   #3
yumener
Member
 
Registered: Oct 2005
Posts: 63

Original Poster
Rep: Reputation: 15
there is a firewall, but both of these two computers
are on the same side of the firewall. It is a good
proof that A can SSH to B because A and B are two
computers in the totally equal status. There should
not be any reasons why A to B can and B to A cannot.

I use the default port but there is no error message
for example, I execute command: ssh computer-A, there
is no response at all, it did not say the port is
not open or the IP is not reachable.


Quote:
Originally Posted by camorri
Have you got a firewall running? Are you using port 22 for sshd on the failing machine?
Could you post the error messages you get?
 
Old 11-22-2006, 09:36 AM   #4
immortaltechnique
Member
 
Registered: Oct 2006
Location: Kenya
Distribution: Ubuntu, RHEL, OpenBSD
Posts: 287

Rep: Reputation: 32
Probably the port 22 on A is not open and if it is then there should be an error message or there is an internal problem with your addresses. what distro are you running?
 
Old 11-22-2006, 11:51 AM   #5
yumener
Member
 
Registered: Oct 2005
Posts: 63

Original Poster
Rep: Reputation: 15
ok, I will check the port.
A is Suse10, B is FC5.

Quote:
Originally Posted by immortaltechnique
Probably the port 22 on A is not open and if it is then there should be an error message or there is an internal problem with your addresses. what distro are you running?
 
Old 11-22-2006, 02:01 PM   #6
spectra
Member
 
Registered: Nov 2006
Location: UK
Distribution: Debian(s) / Gentoo
Posts: 30

Rep: Reputation: 15
If you type telnet <ip addr> 22 on both the machines, you should clearly see the header of the running SSHd, example:

shawr:/home/dave# telnet localhost 22
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
SSH-2.0-OpenSSH_4.3p2 Debian-5.1

Sounds like the SSH daemon is not running on machine A. You can also check this by typing ps aux | grep sshd. You should get something like:

root 2174 0.0 0.9 4928 1112 ? Ss Nov17 0:03 /usr/sbin/sshd

If you don't see a line similiar to this then I suggest you reinstall SSHd. Remember that your system can quite happily have ssh on it allowing you to open SSH connections and not have SSHd running.

Also if by some crazyness you have configured the sshd_config to run SSHd on a different port, you can use the lovely nmap tool to find out what port it is on.

nmap -T5 -sV localhost should do if you have nmap installed.

OR you can even type cat /etc/ssh/sshd_config | grep Port to find out what port your sshd is running on! Hope that helps lol
 
Old 11-23-2006, 06:06 AM   #7
yumener
Member
 
Registered: Oct 2005
Posts: 63

Original Poster
Rep: Reputation: 15
I run the command
a-pc$ telnet localhost 22

it shows something like to SSH-2.0-OpenSSH_4.3p2 Debian-5.1, but if I run the command on B
b-pc$ telnet a-pc-IP 22, the response is
Trying 138.37.90.53...

and wait...

On computer, A can ssh to itself. Does this mean
the port is not a problem?


Quote:
Originally Posted by dave_kv
If you type telnet <ip addr> 22 on both the machines, you should clearly see the header of the running SSHd, example:

shawr:/home/dave# telnet localhost 22
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
SSH-2.0-OpenSSH_4.3p2 Debian-5.1

Sounds like the SSH daemon is not running on machine A. You can also check this by typing ps aux | grep sshd. You should get something like:

root 2174 0.0 0.9 4928 1112 ? Ss Nov17 0:03 /usr/sbin/sshd

If you don't see a line similiar to this then I suggest you reinstall SSHd. Remember that your system can quite happily have ssh on it allowing you to open SSH connections and not have SSHd running.

Also if by some crazyness you have configured the sshd_config to run SSHd on a different port, you can use the lovely nmap tool to find out what port it is on.

nmap -T5 -sV localhost should do if you have nmap installed.

OR you can even type cat /etc/ssh/sshd_config | grep Port to find out what port your sshd is running on! Hope that helps lol
 
Old 11-23-2006, 06:35 AM   #8
yumener
Member
 
Registered: Oct 2005
Posts: 63

Original Poster
Rep: Reputation: 15
is it possible that pc-a has a local firewall setting?
pc-a is installed all by default (because we are newbie).
as I said in the last post, pc-b can ping to pc-a. and
pc-a can ssh to pc-a itself. we have another computer
pc-c in the same local network. pc-c and pc-b can communicate
to each other by ssh, but pc-a is not accessible by ssh to
both pc-b and pc-c. so I guess the problem is still the
setting of pc-a, not the department firewall.



Quote:
Originally Posted by yumener
I run the command
a-pc$ telnet localhost 22

it shows something like to SSH-2.0-OpenSSH_4.3p2 Debian-5.1, but if I run the command on B
b-pc$ telnet a-pc-IP 22, the response is
Trying 138.37.90.53...

and wait...

On computer, A can ssh to itself. Does this mean
the port is not a problem?
 
Old 11-23-2006, 09:41 AM   #9
camorri
LQ 5k Club
 
Registered: Nov 2002
Location: Somewhere inside 9.9 million sq. km. Canada
Distribution: Slackware 15.0, current, slackware-arm-currnet
Posts: 6,229

Rep: Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849
To clear up the questions about firewalls, or port 22 not open, run nmap from either the B machine or the C machine. I have used this technique to verify open ports. Here is a sample on my network. i use SSH on port 22.

Code:
nmap -T5 -sV presto

Starting nmap 3.81 ( http://www.insecure.org/nmap/ ) at 2006-11-23 10:34 EST
Interesting ports on Presto (192.168.1.22):
(The 1659 ports scanned but not shown below are in state: closed)
PORT      STATE SERVICE           VERSION
22/tcp    open  ssh               OpenSSH 4.2p1 Debian-7ubuntu3.1 (protocol 2.0)
111/tcp   open  rpcbind           2 (rpc #100000)
773/tcp   open  rpc
10000/tcp open  snet-sensor-mgmt?
Note the line for port 22, if you get something similar, this is not a firewall or port issue. If it doesn't respond, then it probably is.
 
Old 11-23-2006, 10:28 AM   #10
spectra
Member
 
Registered: Nov 2006
Location: UK
Distribution: Debian(s) / Gentoo
Posts: 30

Rep: Reputation: 15
Spot on, thank you Cliff, couldn't have put it better myself!

Does that answer your question yumener?
 
Old 11-23-2006, 01:08 PM   #11
yumener
Member
 
Registered: Oct 2005
Posts: 63

Original Poster
Rep: Reputation: 15
I run these command on B and the resuts are shown here.

$nmap -T5 -sV pc-a

Starting Nmap 4.20RC1 ( http://insecure.org ) at 2006-11-23 19:04 GMT
Note: Host seems down. If it is really up, but blocking our ping probes, try -P0Nmap finished: 1 IP address (0 hosts up) scanned in 0.760 seconds

$nmap -T5 -sV -P0 pc-a
Starting Nmap 4.20RC1 ( http://insecure.org ) at 2006-11-23 19:06 GMT
Interesting ports on a-pc :
Not shown: 1689 filtered ports
PORT STATE SERVICE VERSION
113/tcp closed auth

Service detection performed. Please report any incorrect results at http://insecure.org/nmap/submit/ .
Nmap finished: 1 IP address (1 host up) scanned in 23.719 seconds


so seems that ssh port is not open? but how can I solve it?


Quote:
Originally Posted by camorri
To clear up the questions about firewalls, or port 22 not open, run nmap from either the B machine or the C machine. I have used this technique to verify open ports. Here is a sample on my network. i use SSH on port 22.

Code:
nmap -T5 -sV presto

Starting nmap 3.81 ( http://www.insecure.org/nmap/ ) at 2006-11-23 10:34 EST
Interesting ports on Presto (192.168.1.22):
(The 1659 ports scanned but not shown below are in state: closed)
PORT      STATE SERVICE           VERSION
22/tcp    open  ssh               OpenSSH 4.2p1 Debian-7ubuntu3.1 (protocol 2.0)
111/tcp   open  rpcbind           2 (rpc #100000)
773/tcp   open  rpc
10000/tcp open  snet-sensor-mgmt?
Note the line for port 22, if you get something similar, this is not a firewall or port issue. If it doesn't respond, then it probably is.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ping works, nmap and ssh do not acampbell Linux - Networking 5 07-24-2006 01:27 PM
block ping and ssh varun_saa Mandriva 1 02-08-2005 06:08 AM
Ping or SSh by hostname ElectroLinux Linux - Newbie 2 10-26-2004 03:21 AM
ping works but ssh not tushar123 Linux - Networking 1 09-29-2004 12:16 PM
can ping but cannot ssh into nodes dogma Linux - Newbie 2 06-10-2003 06:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration