ssh 到预定义服务器仅在我通过手动输入 ip ssh 到它之后才有效

ssh 到预定义服务器仅在我通过手动输入 ip ssh 到它之后才有效

在我的~/.ssh/config文件中我有这个定义

Host limping
    HostName 192.168.1.102
    user <user>

当我在终端输入

ssh limping

我收到错误

ssh: connect to host 192.168.1.102 port 22: No route to host

然后,当我输入

ssh <user>@192.168.1.102

连接有效,我ssh limping也可以通过使用进行连接。

缺什么?

yotam@Orange:/tmp$ netstat -rn 
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 wlp2s0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 wlp2s0
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 wlp2s0

netstat -a连接成功与否,结果是一样的。

yotam@Orange:/tmp$ ifconfig -a
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:104308 errors:0 dropped:0 overruns:0 frame:0
          TX packets:104308 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:11862688 (11.8 MB)  TX bytes:11862688 (11.8 MB)

wlp2s0    Link encap:Ethernet  HWaddr d8:fc:93:cd:c6:9d  
          inet addr:192.168.1.105  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::9a05:8ee4:e73f:1be6/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2526887 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1145245 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2760597592 (2.7 GB)  TX bytes:193162848 (193.1 MB)


yotam@Orange:~/Applications/CondMount$ ssh -v limping
OpenSSH_7.2p2 Ubuntu-4ubuntu2.1, OpenSSL 1.0.2g  1 Mar 2016
debug1: Reading configuration data /home/yotam/.ssh/config
debug1: /home/yotam/.ssh/config line 35: Applying options for limping
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 192.168.1.102 [192.168.1.102] port 22.
debug1: connect to address 192.168.1.102 port 22: No route to host
ssh: connect to host 192.168.1.102 port 22: No route to host

相关内容