简体   繁体   English

在流浪汉中为公共网络设置子网掩码

[英]Setting subnet mask In vagrant for public network

I need to run some services in vagrant, so that its accessible in browser. 我需要在无业游民中运行一些服务,以便可以在浏览器中对其进行访问。 By giving network type as public_network in Vagrantfile, I am getting a vagrant Ip (10.251.70.201). 通过在Vagrantfile中将网络类型指定为public_network ,我得到了一个无业游民的IP(10.251.70.201)。

Now, using this vagrant Ip am able to get these service in other device's browser (which are in the same network: 10.251.70.*). 现在,使用这个无业游民的Ip可以在其他设备的浏览器(位于同一网络:10.251.70。*)中获得这些服务。 Now I need to expand the visibility of the vagrant Ip in other networks (like 10.251.*.*). 现在,我需要在其他网络(例如10.251。*。*)中扩大无业游民Ip的可见性。 How can I achieve this? 我该如何实现?

I assume you are using Virtualbox provider. 我假设您正在使用Virtualbox提供程序。 As an example: 举个例子:

 config.vm.network "public_network", :netmask => "255.255.0.0"

这是对Vagrant版本2配置文件使用Virtualbox提供程序的示例:

config.vm.network "public_network", bridge: "eth0", ip:"192.168.1.20", netmask:"255.255.0.0"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM