如何通过手机ssh到win10上的linux虚拟机集群

由于现在智能手机的功能越来越强大, 有时候简单的工作随时随地都可以完成 。

环境资源:

iphone 6splus 一台(192.168.0.100)

windows10 一台(192.168.0.101)

windows10上装有10来个虚拟机(当然不能同时跑起来,可以根据需要选择相应的集群运行)(192.168.56.100-192.168.56.106, 192.168.56.109-192.168.56.111 )

无线路由一台(192.168.0.1)

nat123(22端口映射,实现内网穿透,已达到在外面访问在自己家的电脑)


步骤1:安装nat123

在windows上安装nat123。

下载地址:

百度云: http://pan.baidu.com/s/1geUsCWr

备用较慢下载地址:ftp://119.29.5.84/nat123_V1.160421_NET4.zip

然后去http://www.nat123.com注册账号, 配置端口映射 。

如何通过手机ssh到win10上的linux虚拟机集群

我这里建立了两个端口映射, 22就是用来ssh到我的windows的, 8080是用来做github webhook的。

现在登录自己电脑上的nat123客户端 。

注:如果是在windows上其实可以建立全部端口映射,然后安装访问者就好了,不用一个一个端口去映射, 我这里主要是手机没有nat123 app

如何通过手机ssh到win10上的linux虚拟机集群

这样通过任意设备任何地方就能ssh到我的windows了 。


步骤2 安装win10 bash

1)

window键=》设置=》在查找设置框中输入(针对开发人员设置,回车)=》选择左边的针对开发人员=》选择右边的开发人员模式

2)

控制面板=》程序=》程序与功能(启用或关闭windows功能)=》勾选使用于linux的windows子系统(Beta)=》重启计算机

3)在window键旁边的搜索框输入bash回车=》bash界面就打开了,然后他会自动下载

4)安装openssh

apt-get install openssh-server

配置sshd:

vi /etc/ssh/sshd_config

#PermitRootLogin prohibit-password
PermitRootLogin yes

PasswordAuthentication yes

启动sshd服务:service ssh start  

测试服务启动成功如下:

[email protected]:~# ssh localhost
The authenticity of host 'localhost (127.0.0.1)' can't be established.
ECDSA key fingerprint is SHA256:t3PjqfX4paSINm11MOHq9InWvG//uKLIUCKHMFrPIy4.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts.
[email protected]'s password:
Welcome to Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-43-Microsoft x86_64)


 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage


  Get cloud support with Ubuntu Advantage Cloud Guest:
    http://www.ubuntu.com/business/services/cloud


138 个可升级软件包。
55 个安全更新。




Last login: Sat Nov 11 22:56:15 2017 from 127.0.0.1

步骤三:手机测试ssh windows

手机下载Termius app=》添加hosts=》点‘+‘, =》hostname 192.168.0.101 , use ssh 打开, username root=》Save

点击hosts列表中刚添加的项发现ssh成功

如何通过手机ssh到win10上的linux虚拟机集群


接下来 就可以任意的访问虚拟机了 。

但是如果不在自己的网络环境就需要访问:XXXX.nat123.cc:52148

至于虚拟机cluster搭建可以参照前面的博客:http://blog.****.net/billwang_guoyun/article/details/78255583

[email protected]:~# ssh 192.168.56.100
[email protected]'s password:
Last login: Sat Nov 11 09:55:22 2017 from 192.168.56.1
[[email protected] ~]# ls



现在就结束了, 主要是记录下来以后自己使用, 同时希望对有同样需要的人有一些帮助 。