LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Configuring SSH on Ubuntu to connect to remote computer (https://www.linuxquestions.org/questions/linux-networking-3/configuring-ssh-on-ubuntu-to-connect-to-remote-computer-4175434420/)

guitarman 10-27-2012 08:12 PM

Configuring SSH on Ubuntu to connect to remote computer
 
Hi there.

I'm having problems when I try to connect remotely to other computer using open ssh server, using this command:

ssh example@11.111.11

it returns "connection timed out" after a while.

So, I went through all sorts of websites and tutorials to see what's going on. I tried enabling the standard port 22 on my firewall and tried to create a static IP adress so I can use port 22 properly. But it looks it doesn't worked.

I don't know if this makes any difference, but my Ubuntu is connected via wireless to a router (D-Link DI-524) and I tried to change some configurations on it too. But still it doesnt work at all.

Any clue please? I'm using ubuntu 11.10. Cheers

Reuti 10-28-2012 09:02 AM

You mean from the outside to your machine at home behind the router? It needs a) a fixed TCP/IP address and not a random one from the DHCP server in the router, b) it’s necessary to define a forwarding in the router, that incoming packets for port 22 are routed to this particular machine all the time.

guitarman 10-28-2012 11:33 AM

I've already done this, and still it doesn't work.

Reuti 10-28-2012 11:54 AM

The sshd is running on the Ubuntu machine, i.e.: you can log in via ssh on the machine itself by connecting to localhost?

suicidaleggroll 10-28-2012 12:37 PM

I think you need to explain your situation a bit more clearly. You only mention one computer in your post, yet ssh requires two computers (a client and a server). Which one is your ubuntu machine? Where is the other one? Are you trying to connect from within the LAN or from the outside world? Which one have you been adjusting the settings on? We need a much clearer picture of what you're trying to do here before we can offer any substantial advice.

guitarman 10-28-2012 09:34 PM

Quote:

Originally Posted by Reuti (Post 4816819)
The sshd is running on the Ubuntu machine, i.e.: you can log in via ssh on the machine itself by connecting to localhost?

Yes, I can. This works fine.

guitarman 10-28-2012 09:36 PM

Quote:

Originally Posted by suicidaleggroll (Post 4816843)
I think you need to explain your situation a bit more clearly. You only mention one computer in your post, yet ssh requires two computers (a client and a server). Which one is your ubuntu machine? Where is the other one? Are you trying to connect from within the LAN or from the outside world? Which one have you been adjusting the settings on? We need a much clearer picture of what you're trying to do here before we can offer any substantial advice.

The situation is this: I am the client, trying to conect to the server, which is already set up with ssh and with others clients works well. It runs ubuntu 10. I am trying to connect toe the outside world, outside my LAN. I am adjusting the settings on my computer, which I try to connect to the server.

schneidz 10-28-2012 09:40 PM

please post the output of:
Code:

ping -c 5 www.02144.com
ping -c 5 11.111.11
ssh -v -v -v  example@11.111.11

replace whatever is in red with the actual user name or server address you are trying to connect to.

guitarman 10-28-2012 10:24 PM

Quote:

Originally Posted by schneidz (Post 4817125)
please post the output of:
Code:

ping -c 5 www.02144.com
ping -c 5 11.111.11
ssh -v -v -v  example@11.111.11

replace whatever is in red with the actual user name or server address you are trying to connect to.

PING 02144.com (64.235.229.141) 56(84) bytes of data.
64 bytes from 64.235.229.141: icmp_req=1 ttl=50 time=511 ms
64 bytes from 64.235.229.141: icmp_req=2 ttl=50 time=629 ms
^C64 bytes from 64.235.229.141: icmp_req=3 ttl=50 time=317 ms

--- 02144.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 12687ms
rtt min/avg/max/mdev = 317.364/486.385/629.813/128.834 ms

PING xxx.xx.xxx.xxx (xxx.xx.xxx.xxx) 56(84) bytes of data.
64 bytes from xxx.xx.xxx.xxx: icmp_req=1 ttl=54 time=137 ms
64 bytes from xxx.xx.xxx.xxx: icmp_req=2 ttl=54 time=20.9 ms
64 bytes from xxx.xx.xxx.xxx: icmp_req=3 ttl=54 time=21.9 ms
64 bytes from xxx.xx.xxx.xxx: icmp_req=4 ttl=54 time=21.3 ms
64 bytes from xxx.xx.xxx.xxx: icmp_req=5 ttl=54 time=22.6 ms

--- xxx.xx.xxx.xxx ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4005ms
rtt min/avg/max/mdev = 20.984/44.799/137.127/46.167 ms

OpenSSH_5.8p1 Debian-7ubuntu1, OpenSSL 1.0.0e 6 Sep 2011
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to xxx.xx.xxx.xxx [xxx.xx.xxx.xxx] port 22.
debug1: connect to address xxx.xx.xxx.xxx port 22: Connection timed out
ssh: connect to host xxx.xx.xxx.xxx port 22: Connection timed out

schneidz 10-29-2012 10:25 AM

sorry, i dont have an answer but this mite help diagnose:
Code:

nmap -p 22 11.111.11
seems like a firewall issue... check /etc/hosts.allow / /etc/hosts.deny

guitarman 10-29-2012 01:17 PM

Quote:

Originally Posted by schneidz (Post 4817474)
sorry, i dont have an answer but this mite help diagnose:
Code:

nmap -p 22 11.111.11
seems like a firewall issue... check /etc/hosts.allow / /etc/hosts.deny

Starting Nmap 5.21 ( http://nmap.org ) at 2012-10-29 16:11 BRST
Note: Host seems down. If it is really up, but blocking our ping probes, try -PN
Nmap done: 1 IP address (0 hosts up) scanned in 3.44 seconds

I checked the two files either and the two seem ok. Also I tried disabling the firewall and it also doesnt worked.

schneidz 10-29-2012 01:24 PM

as far as your nmap thinks the remote host doesnt have an ssh server running on port 22. you can retry the command like this:
Code:

nmap -PN -p 22 11.111.11
but it will probably tell you that that port is filtered.

are you able to try on another pc at another location ?

edit: also, just for the shiggles, what does this yeild you:
Code:

nmap  -p 22 www.02144.com

guitarman 10-29-2012 01:50 PM

Quote:

Originally Posted by schneidz (Post 4817590)
as far as your nmap thinks the remote host doesnt have an ssh server running on port 22. you can retry the command like this:
Code:

nmap -PN -p 22 11.111.11
but it will probably tell you that that port is filtered.

are you able to try on another pc at another location ?

edit: also, just for the shiggles, what does this yeild you:
Code:

nmap  -p 22 www.02144.com

Yes, it told me that the port is filtered.

Starting Nmap 5.21 ( http://nmap.org ) at 2012-10-29 16:48 BRST
Nmap scan report for www.02144.com (64.235.229.141)
Host is up (0.57s latency).
PORT STATE SERVICE
22/tcp open ssh

schneidz 10-29-2012 02:01 PM

^ so the nmap above states that 02144.com's ssh server is on and open to accepting connections from your pc. it seems like the other server you are trying to connect to is on but its ssh server is off.

maybe they only allow connections from inside their building ? my workplace is like that; if i want to work-from-home i would need to connect via vpn which makes it appear as if i am connecting from inside the building.

emi_ramo 11-06-2012 07:07 AM

Having sshd installed and running, what is going on is one of these (or both):
1) You have a firewall installed on server blocking incoming connections to port 22 (or not explicitly ACCEPTing them)
2) Your router is not routing/NATing incoming connections to port 22 to your internal server.

You can almost debug 1) by trying to connect to the server from a PC into the same local network. You can debug 2) by checking server's IP and router's NATing table and, if exists, router's firewall rules. Of course, you shouldn't use DCHP on the server. Use fixed/static IP.


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