如何使用 ssh 通过互联网连接到另一台计算机?

如何使用 ssh 通过互联网连接到另一台计算机?

Ubuntu 13.10笔记本电脑我想用它来连接我的Ubuntu 12.04 桌面。我安装了打开 ssh 服务器在台式机上使用:

sudo apt-get install openssh-server

我检查服务器是否正在运行:

sudo service ssh start

我得到:

start: Job is already running: ssh

接下来我使用以下命令检查是否存在防火墙:

sudo ufw status

我得到:

Status: inactive

接下来我发现桌面的 IP 地址通过执行:

ip addr | grep inet

我得到:

inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host 
inet 193.51.236.62/24 brd 193.51.236.255 scope global eth0
inet6 fe80::21a:a0ff:fe10:e8da/64 scope link 

所以我认为193.51.236.62是我的 IP 地址。

然后在我的笔记本电脑上我验证193.51.236.62可以 ping 通,然后我执行以下操作:

ssh -v [email protected]

我得到:

OpenSSH_6.2p2 Ubuntu-6ubuntu0.1, OpenSSL 1.0.1e 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 193.51.236.62 [193.51.236.62] port 22.

似乎没有其他事情发生。请问我该如何解决此问题?我做错了什么?

编辑:

我可以安全地 ping 服务器:

martin@martin-Studio-1537:~$ ping -c3 193.51.236.62
PING 193.51.236.62 (193.51.236.62) 56(84) bytes of data.
64 bytes from 193.51.236.62: icmp_seq=1 ttl=61 time=2.82 ms
64 bytes from 193.51.236.62: icmp_seq=2 ttl=61 time=4.05 ms
64 bytes from 193.51.236.62: icmp_seq=3 ttl=61 time=4.08 ms

--- 193.51.236.62 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 2.823/3.653/4.082/0.587 ms

编辑2:

我尝试按照建议来诊断连接nmap

martin@martin-Studio-1537:~$ nmap 193.51.236.62

Starting Nmap 6.40 ( http://nmap.org ) at 2014-01-31 18:39 CET
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.06 seconds

进而:

martin@martin-Studio-1537:~$ nmap -Pn 193.51.236.62

Starting Nmap 6.40 ( http://nmap.org ) at 2014-01-31 18:40 CET
Nmap scan report for 193-51-236-62.lille.inria.fr (193.51.236.62)
Host is up (0.0056s latency).
Not shown: 998 filtered ports
PORT     STATE SERVICE
3128/tcp open  squid-http
8080/tcp open  http-proxy

Nmap done: 1 IP address (1 host up) scanned in 8.18 seconds

答案1

首先检查是否可以 ssh 进入桌面从桌面

ssh 127.0.0.1

如果有效,我会检查外部 IP 和内部 IP 是否不同。

相关内容