博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
virtualbox+vagrant学习-3-Vagrant Share-4-Vagrant Connect
阅读量:6032 次
发布时间:2019-06-20

本文共 4167 字,大约阅读时间需要 13 分钟。

Vagrant Connect

vagrant可以共享到vagrant环境的任何或每个端口,而不仅仅是SSH和HTTP。“vagrant connect”命令为连接人员提供一个静态IP,他们可以使用该IP与共享的vagrant环境通信。发送到此IP的任何TCP流量都被发送到共享的vagrant环境。

 

1.Usage

即调用vagrant share --full命令

这将自动为远程连接共享尽可能多的端口。更多信息请查看 页面。

注意在调用vagrant share --full命令末尾的共享名字,并将其提供给希望连接到你的机器的人。他们只需要简单地调用vagrant connect NAME命令即可(和上一篇ssh的连接方法一样)。这将给他们一个静态IP,他们可以使用它来访问你的vagrant环境。

userdeMacBook-Pro:~ user$ vagrant share --full --http 80Vagrant Share now defaults to using the `ngrok` driver.The `classic` driver has been deprecated.For more information about the `ngrok` driver, pleaserefer to the documentation:  https://www.vagrantup.com/docs/share/==> default: Detecting network information for machine...    default: Local machine address: 127.0.0.1    default:      default: Note: With the local address (127.0.0.1), Vagrant Share can only    default: share any ports you have forwarded. Assign an IP or address to your    default: machine to expose all TCP ports. Consult the documentation    default: for your provider ('virtualbox') for more information.    default:      default: Local HTTP port: 80    default: Local HTTPS port: disabled    default: Port: 2222==> default: Creating Vagrant Share session...    share: Importing base box 'hashicorp/vagrant-share'...    share: Matching MAC address for NAT networking...    share: Setting the name of the VM: share-fe65ef45-f050-4cc9-98ba-bd19ec32d8e0    share: Fixed port collision for 22 => 2222. Now on port 2200.    share: Vagrant has detected a configuration issue which exposes a    share: vulnerability with the installed version of VirtualBox. The    share: current guest is configured to use an E1000 NIC type for a    share: network adapter which is vulnerable in this version of VirtualBox.    share: Ensure the guest is trusted to use this configuration or update    share: the NIC type using one of the methods below:    share:     share:   https://www.vagrantup.com/docs/virtualbox/configuration.html#default-nic-type    share:   https://www.vagrantup.com/docs/virtualbox/networking.html#virtualbox-nic-type    share: Clearing any previously set network interfaces...    share: Preparing network interfaces based on configuration...    share: Adapter 1: nat    share: Forwarding ports...    share: 31338 (guest) => 65535 (host) (adapter 1)    share: 22 (guest) => 2200 (host) (adapter 1)    share: Running 'pre-boot' VM customizations...    share: Booting VM...    share: Waiting for machine to boot. This may take a few minutes...    share: SSH address: 127.0.0.1:2200    share: SSH username: tc    share: SSH auth method: password    share:     share: Inserting generated public key within guest...    share: Removing insecure key from the guest if it's present...    share: Key inserted! Disconnecting and reconnecting using new SSH key...    share: Machine booted and ready!==> share: ==> share: Your Vagrant Share is running! Name: budget_hello:agenda_design==> share: ==> share: You're sharing full access to your Vagrant machine. This means that==> share: another user can have access to your Vagrant machine by running:==> share: ==> share:   vagrant connect budget_hello:agenda_design==> share: ==> share: HTTP URL: http://5fd8f0d7.ngrok.io==> share: ==> share: ==> share: Your Vagrant Share is running! Name: budget_hello:agenda_design==> share: ==> share: You're sharing full access to your Vagrant machine. This means that==> share: another user can have access to your Vagrant machine by running:==> share: ==> share:   vagrant connect budget_hello:agenda_design==> share: ==> share: HTTP URL: http://5fd8f0d7.ngrok.io==> share:

相应虚拟机也已经打开:

 

2.How does it work?

vagrant connect的运行是通过做vagrant最擅长的事情:管理虚拟机来实现的。vagrant connect使用VirtualBox或VMware(更多的提供者支持即将到来)创建了一个只占用20 MB内存的小型虚拟机。

然后,发送到这个小型虚拟机的任何流量都被代理到共享的vagrant环境,就好像它被定向到这个环境一样。

$vagrant connect budget_hello:agenda_design

 

3.Beware: Vagrant Insecure Key

如果你正在使用的vagrant环境或box是受到vagrant不安全密钥对(大多数公共box都是)的保护,那么连接到SSH的任何人都可以轻松地使用SSH。

虽然你希望与你信任的人共享,但在某些环境中,你可能与类或conference共享,并且不希望它们能够SSH进入。

在这种情况下,我们建议从vagrant计算机中更改或删除不安全的密钥。

最后,我们要注意,我们正在努力使之在使用vagrant share时,除非显式允许,否则vagrant私钥将被主动拒绝。但是,这个特性还没有完成。

转载于:https://www.cnblogs.com/wanghui-garcia/p/10174624.html

你可能感兴趣的文章
NYOJ 97
查看>>
poj2378
查看>>
【译】SQL Server误区30日谈-Day12-TempDB的文件数和需要和CPU数目保持一致
查看>>
不为技术而技术:大型网站架构演化解析
查看>>
Java文件清单列表
查看>>
js url传值中文乱码之解决之道
查看>>
Atitit.获取某个服务 网络邻居列表 解决方案
查看>>
Trusty TEE
查看>>
[LeetCode] Reverse String 翻转字符串
查看>>
学习iOS【3】数组、词典和集合
查看>>
Hessian 原理分析--转
查看>>
转: 基于netty+ protobuf +spring + hibernate + jgroups开发的游戏服务端
查看>>
easyui传入map的数据前台展示出tree格式数据
查看>>
悲观的思考,乐观的生活.我们既需要思考的深度,也需要生活的温度!
查看>>
java.math.BigDecimal
查看>>
Vitamio中文API文档(4)—— VitamioInstaller
查看>>
河内之塔
查看>>
图像处理之基础---内窥镜医学图像增强
查看>>
yii框架常用url地址
查看>>
python3.4学习笔记(十六) windows下面安装easy_install和pip教程
查看>>