ssh ubuntu 到 android:没有到主机的路由

ssh ubuntu 到 android:没有到主机的路由

我正在尝试使用我的笔记本电脑(ubuntu 12.04)登录我的 Android 手机(运行 sshdroid)。我位于大学子网(通过 wifi),我的手机也是如此。我尝试了以下命令:

ssh root@my_phone_ip -p 2222

但笔记本电脑却回击了

ssh: connect to host 172.20.27.169 port 2222: No route to host

我什至无法 ping 通我的手机,它给出了目标主机无法访问的错误。我在我的笔记本电脑上查找了路线信息,这是

root@abadmin-Vostro-3500:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

default         eduspot-berlioz 0.0.0.0         UG    0      0        0 wlan0

link-local      *               255.255.0.0     U     1000   0        0 wlan0

172.16.185.0    *               255.255.255.0   U     0      0        0 vmnet1

172.20.0.0      *               255.255.0.0     U     2      0        0 wlan0

192.168.248.0   *               255.255.255.0   U     0      0        0 vmnet8

为了检查正在通过哪些数据包,我尝试了 tcpdump -i wlan0,但我找不到任何有趣的数据包。我在此处插入转储以获取更多信息。

root@abadmin-Vostro-3500:~# tcpdump -i wlan0 
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on wlan0, link-type EN10MB (Ethernet), capture size 65535 bytes
19:45:12.354445 IP6 fe80::1416:f700:ff98:a65 > ff02::1:ff3a:6694: ICMP6, neighbor solicitation, who has fe80::51e2:6e29:ff3a:6694, length 32
19:45:12.355303 IP abadmin-Vostro-3500.local.54924 > eduspot-berlioz.crous- grenoble.fr.domain: 44239+ PTR?       4.9.6.6.a.3.f.f.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.f.f.ip6.arpa. (90)
19:45:12.364296 IP eduspot-berlioz.crous-grenoble.fr.domain > abadmin-Vostro-3500.local.54924: 44239 NXDomain 0/0/0 (90)
19:45:12.364742 IP abadmin-Vostro-3500.local.53789 > eduspot-berlioz.crous-grenoble.fr.domain: 29641+ PTR? 5.6.a.0.8.9.f.f.0.0.7.f.6.1.4.1.0.0.0.0.0.0.0.0.0.0.0.0.0.8.e.f.ip6.arpa. (90)
19:45:12.368422 IP eduspot-berlioz.crous-grenoble.fr.domain > abadmin-Vostro-3500.local.53789: 29641 NXDomain 0/0/0 (90)
19:45:12.368740 IP abadmin-Vostro-3500.local.2590 > eduspot-berlioz.crous-grenoble.fr.domain: 39336+ PTR? 4.9.6.6.a.3.f.f.9.2.e.6.2.e.1.5.0.0.0.0.0.0.0.0.0.0.0.0.0.8.e.f.ip6.arpa. (90)
19:45:12.373988 IP eduspot-berlioz.crous-grenoble.fr.domain > abadmin-Vostro-3500.local.2590: 39336 NXDomain 0/0/0 (90)
19:45:12.374372 IP abadmin-Vostro-3500.local.5879 > eduspot-berlioz.crous-grenoble.fr.domain: 3348+ PTR? 254.255.20.172.in-addr.arpa. (45)
19:45:12.389099 IP eduspot-berlioz.crous-grenoble.fr.domain > abadmin-Vostro-3500.local.5879: 3348* 1/0/0 PTR eduspot-berlioz.crous-grenoble.fr. (92)
19:45:12.389455 IP abadmin-Vostro-3500.local.30761 > eduspot-berlioz.crous-grenoble.fr.domain: 14063+ PTR? 186.27.20.172.in-addr.arpa. (44)
19:45:12.393315 IP eduspot-berlioz.crous-grenoble.fr.domain > abadmin-Vostro-3500.local.30761: 14063 NXDomain 0/0/0 (44)
^C  19:45:12.411446 IP 172.20.18.214.netbios-ns > 172.20.255.255.netbios-ns: NBT UDP   PACKET(137): QUERY; REQUEST; BROADCAST

12 packets captured
525 packets received by filter
483 packets dropped by kernel

iptables 输出:

Chain INPUT (policy ACCEPT) target prot opt source destination 
ACCEPT 47 -- 0.0.0.0/0 0.0.0.0/0 
Chain FORWARD (policy ACCEPT) target prot opt source destination 
Chain OUTPUT (policy ACCEPT) target prot opt source destination' 

请帮我登录我的手机..这让我沮丧了两天。提前致谢

答案1

编辑您的防火墙以接受端口 2222:

iptables -A INPUT -p tcp --dport 2222 -j ACCEPT

如果它不能解决问题,selinux 可能是问题所在,所以请尝试以下操作:

使其允许端口 2222:

semanage port -a -t ssh_port_t -p tcp 2222

还可以使用 nmap 查看端口是否打开:

nmap -p 2222 172.20.27.169

如果您更改了任何配置文件(定义端口 2222),则必须重新启动 sshd:

service sshd restart

相关内容