VirtualBox+openwrt+ubuntu16.04 实现ssh

一、在VirtualBox中配置openwrt

  • 下载地址

    https://downloads.openwrt.org/chaos_calmer/15.05.1
    选择x86-64
    openwrt-15.05.1-x86-64-combined-ext4.img.gz

  • 镜像转换

    cmd下
    VBoxManage convertfromraw -format VDI penwrt-15.05.1-x86-64-combined-ext4.img openwrt.vdi
    windows下使用VBoxManage.exe(可能需要全路径)

    VirtualBox+openwrt+ubuntu16.04 实现ssh_第1张图片

  • 创建openwrt虚拟机

    不用添加虚拟硬盘,完成后在设置存储中添加vdi

    VirtualBox+openwrt+ubuntu16.04 实现ssh_第2张图片

  • 配置网卡

    这里我用的host-only,用其他的也可以,看自己的需求吧。

  • 然后就可以启动了

    启动时中间如果停住不动了,敲一下回车就可以了。
    设置初始密码passwd
    查看一下网络配置ifconfig 直接看ifconfig br-lan
    可以看见它初始的address是192.168.1.1,然后我们把它改成192.168.1.100

    VirtualBox+openwrt+ubuntu16.04 实现ssh_第3张图片


二、在VirtualBox中配置ubuntu16.04

    >  本来想传一个的,结果发现只能上传60M以内的,就只有算了,你们自己网上找一个吧,我用的是这个=>ubuntukylin-16.04-desktop-amd64.iso
  • 同样创建一个虚拟机

    创建虚拟硬盘,然后一直下一步就好了。
    然后在设置存储中点击光盘配置iso

    这里写图片描述

    然后配置网卡,同样配置的host-only
    然后就可以启动安装了。这个版本安装还是很简单的,大概20多分钟就装好了。
    设置root密码 sudo passwd

  • 然后配置ip

    ifconfig查看网卡信息
    可以看见你的网卡名称,我的是enp0s3,然后就可以配置了
    vim /etc/network/interfaces
    添加
    auto enp0s3
    iface enp0s3 inet static
    address 192.168.1.2
    netmask 255.255.255.0
    gateway 192.168.1.1

    重启网卡
    /etc/init.d/networking restart


三、配置VirtualBox Host-Only Network

win8的系统在控制面板中搜索网络连接-查看网络连接就可以了看到了。 在属性里面设置internet版本协议4
VirtualBox+openwrt+ubuntu16.04 实现ssh_第4张图片


四、互ping并实现ssh

这里我用的ubuntu虚拟机ping的openwrt和宿主机。
VirtualBox+openwrt+ubuntu16.04 实现ssh_第5张图片

  • 然后ssh openwrt

ssh -l root 192.168.1.100VirtualBox+openwrt+ubuntu16.04 实现ssh_第6张图片

  • 查看openwrt管理页面

登录192.168.1.100,密码是openwrt设置的密码
VirtualBox+openwrt+ubuntu16.04 实现ssh_第7张图片VirtualBox+openwrt+ubuntu16.04 实现ssh_第8张图片

你可能感兴趣的:(mysql,linux-shell)