SSH:没有到主机的路由

SSH:没有到主机的路由

我有两台笔记本电脑,都安装了 Ubuntu 14.04 LTS。我已将它们连接到同一个无线网络。现在我在 Ubuntu 上安装了 ssh 服务器。现在我试图访问其他笔记本电脑(比如 B)的桌面,但出现了如下错误

    Ssh:connect to host 192.168.0.102 port 22: No route to host

我正在使用以下命令

    ssh [email protected]

以下是 ifconfig 的输出

     eth0      Link encap:Ethernet  HWaddr 28:92:4a:1e:eb:ed  
      UP BROADCAST MULTICAST  MTU:1500  Metric:1
      RX packets:0 errors:0 dropped:0 overruns:0 frame:0
      TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000 
      RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

     lo        Link encap:Local Loopback  
      inet addr:127.0.0.1  Mask:255.0.0.0
      inet6 addr: ::1/128 Scope:Host
      UP LOOPBACK RUNNING  MTU:65536  Metric:1
      RX packets:614 errors:0 dropped:0 overruns:0 frame:0
      TX packets:614 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0 
      RX bytes:53218 (53.2 KB)  TX bytes:53218 (53.2 KB)

      wlan0     Link encap:Ethernet  HWaddr 08:3e:8e:0e:4f:4b  
      inet addr:192.168.0.100  Bcast:192.168.0.255  Mask:255.255.255.0
      inet6 addr: fe80::a3e:8eff:fe0e:4f4b/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:1412 errors:0 dropped:0 overruns:0 frame:13931
      TX packets:1931 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000 
      RX bytes:557138 (557.1 KB)  TX bytes:240606 (240.6 KB)
      Interrupt:17 

当我执行 ping 时会发生以下情况

      PING 192.168.0.102 (192.168.0.102) 56(84) bytes of data.
      From 192.168.0.100 icmp_seq=9 Destination Host Unreachable
      From 192.168.0.100 icmp_seq=10 Destination Host Unreachable
      From 192.168.0.100 icmp_seq=11 Destination Host Unreachable
      From 192.168.0.100 icmp_seq=12 Destination Host Unreachable
      From 192.168.0.100 icmp_seq=13 Destination Host Unreachable
      From 192.168.0.100 icmp_seq=14 Destination Host Unreachable
      From 192.168.0.100 icmp_seq=15 Destination Host Unreachable
      From 192.168.0.100 icmp_seq=16 Destination Host Unreachable
      From 192.168.0.100 icmp_seq=17 Destination Host Unreachable
      From 192.168.0.100 icmp_seq=18 Destination Host Unreachable
      From 192.168.0.100 icmp_seq=19 Destination Host Unreachable
      From 192.168.0.100 icmp_seq=20 Destination Host Unreachable
      From 192.168.0.100 icmp_seq=21 Destination Host Unreachable
      From 192.168.0.100 icmp_seq=22 Destination Host Unreachable
      From 192.168.0.100 icmp_seq=23 Destination Host Unreachable
      From 192.168.0.100 icmp_seq=24 Destination Host Unreachable
      From 192.168.0.100 icmp_seq=25 Destination Host Unreachable
      From 192.168.0.100 icmp_seq=26 Destination Host Unreachable
      From 192.168.0.100 icmp_seq=27 Destination Host Unreachable
      From 192.168.0.100 icmp_seq=28 Destination Host Unreachable
      From 192.168.0.100 icmp_seq=29 Destination Host Unreachable
      From 192.168.0.100 icmp_seq=30 Destination Host Unreachable
      From 192.168.0.100 icmp_seq=31 Destination Host Unreachable
      From 192.168.0.100 icmp_seq=32 Destination Host Unreachable
      and so on.....

netstat -rn 的输出

      Kernel IP routing table
      Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
      0.0.0.0         192.168.0.1     0.0.0.0         UG        0 0          0 wlan0
      192.168.0.0     0.0.0.0         255.255.255.0   U         0 0          0 wlan0

答案1

也许您需要禁用防火墙...您可以使用 nmap 检查 ssh 服务器是否正在运行并监听网络(需要先安装它):

apt-get install nmap -y

nmap -p22 192.168.0.102

您需要看到类似的内容,表明端口 22(ssh 端口)已打开:

root@srkv12b3:/home/monitor# nmap  -p22 192.168.19.4
Starting Nmap 7.01 ( https://nmap.org ) at 2016-04-06 11:08 CEST
Nmap scan report for 192.168.19.4
Host is up (0.000033s latency).
PORT   STATE SERVICE
22/tcp open  ssh

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

相关内容