zoukankan      html  css  js  c++  java
  • Vagrant+Secure CRT的使用

    实际上,大家通过查看自动生成的配置文件:Vagrantfile  知道以下配置方式

    一、Vagrant默认的三种网络配置

    一种是端口映射,第二种是私有网络,第三种是公有网络。
    (1)端口映射 

    配置一个端口映射的规则,然后访问指定的端口,VAGRANT会转发到虚拟机端口上处理。配置方法如下:

    # Create a forwarded port mapping which allows access to a specific port
    # within the machine from a port on the host machine. In the example below,
    # accessing "localhost:8080" will access port 80 on the guest machine.
    # NOTE: This will enable public access to the opened port  名为guest的虚拟机80端口映射宿主机host的8080端口

       config.vm.network "forwarded_port", guest: 80, host: 8080


    (2)私有网络

    配置一个私有的IP地址,用于宿主机和虚拟机之间的访问,如果多个虚拟机设置的是相同的网段,那么虚机可以互相访问。

    # Create a private network, which allows host-only access to the machine
    # using a specific IP.

       config.vm.network "private_network", ip: "192.168.33.18"

    (3)公有网络

    设置公有网络,不仅仅是宿主机可以访问,它也拥有一个静态的IP,这样整个网段的人都可以访问VAGRANT创建的虚拟机。

    # Create a public network, which generally matched to bridged network.
    # Bridged networks make the machine appear as another physical device on
    # your network.

       config.vm.network "public_network", ip: "192.168.33.18"

    二、SecureCRT连接示例:使用的是私有网络方式

    (1)vagrant halt  重启虚拟机
    (2)Vagrantfile文件中添加下列配置
       config.vm.network "private_network", ip: "192.168.33.18"
    (3)vagrant up

    (1)本地连接为  127.0.0.1 端口为2222。口令用户名密码为vagrant

    (2)使用配置的私有网络地址连接  192.168.33.18  端口为 22

    在用SecureCRT连接的时候一直报Permission denied (publickey,gssapi-keyex,gssapi-with-mic)。这里总是要找public key。而默认我们使用vagrant ssh都是免密码登陆的。为了避免这个麻烦,需要将/etc/ssh/sshd_conf中的PasswordAuthentication no改为PasswordAuthentication yes。同时设置下vagrant的密码。就可以通过192.168.33.18登陆了。

     

  • 相关阅读:
    flex布局中transform出错
    RabbitMQ系列之Centos 7安装RabbitMQ 3.6.1
    解决windows下FileZilla server中文乱码问题
    IIS 7.5 + PHP-5.6.3 + mysql-5.6.21.1
    C# 速编神器LinqPad(新版6.5)
    一个MySql Sql 优化技巧分享
    IIS反向代理/Rewrite/https卸载配置
    zerotier 远程办公方案
    一次Mysql连接池卡死导致服务无响应问题分析(.Net Mysql.Data 6.9.9)
    ExpressCache
  • 原文地址:https://www.cnblogs.com/chaos-li/p/11970498.html
Copyright © 2011-2022 走看看