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登陆了。

     

  • 相关阅读:
    澳门两日游之续一
    记澳门两日游0516
    [原创]北大ACM POJ 1050题解
    [原创]百度之星低频词过滤题解
    [原创]百度之星题解之重叠区间大小
    澳门两日游之续三
    澳门两日游之续二
    [原创]LZW网页判重的题解
    [原创]北大ACM POJ 1032题解
    创建产品列表控件时触发自定义DataUpated事件时,设置MultiView.ActiveViewIndex无效
  • 原文地址:https://www.cnblogs.com/chaos-li/p/11970498.html
Copyright © 2011-2022 走看看