Multi-Machine shared host-only network - keeps creating more adapters

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Multi-Machine shared host-only network - keeps creating more adapters

Ian Koenig
I'm attempting to setup a host-only network that is shared between multiple VMs as part of the configuration of the environment.  

As such the end goal is that each VM has its required NAT network on adapter 1 and then has an adapter that is on a host-only shared network that they can all talk over.   On this then I can set IPs as needed to do other simple configurations successfully in a set network design.   

Every time I end up destroying and re-creating the environments I have another new host-only adapter created.    Right now in my testing I'm up around 15 Host-only adapters in my system which is a tad much.

Is there any way to say "use the first/second or third" private_network (Host-Only Adapter) so vagrant doesn't keep creating new adapters?

Example Vagrantfile:


# -*- mode: ruby -*-
# vi: set ft=ruby :
# Every Vagrant development environment requires a box. You can search for # boxes at https://atlas.hashicorp.com/search.


BOX_IMAGE
= "centos/7"
NODE_COUNT
= 1
Vagrant.configure("2") do |config|  
 config
.vm.define "master" do |subconfig|    
 subconfig
.vm.box = BOX_IMAGE    
 subconfig
.vm.hostname = "master"    
 subconfig
.vm.network :private_network, ip: "10.0.0.10"  
 
#subconfig.vm.network :public_network
 
end    


 
(1..NODE_COUNT).each do |i|    
 config
.vm.define "node#{i}" do |subconfig|      
 subconfig
.vm.box = BOX_IMAGE      
 subconfig
.vm.hostname = "node#{i}"      
 subconfig
.vm.network :private_network, ip: "10.0.0.#{i + 10}"    
 
end  
 
end  
end

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/e3b07b90-dc0d-42fe-91cd-4ba920620da6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Multi-Machine shared host-only network - keeps creating more adapters

Ian Koenig
I figured out that for whatever reason why I am using subnet 192.168.233.0/24 virtualbox can't appear to save that configuration properly so the Network adapters come up with a 169.254 definition for the address.   When I changed my subnet over to any other subnet, it starts working as you'd expect.  Find a Host-Only that matches that subnet and use it, otherwise create it.  



On Thursday, 25 May 2017 10:34:46 UTC-5, Ian Koenig wrote:
I'm attempting to setup a host-only network that is shared between multiple VMs as part of the configuration of the environment.  

As such the end goal is that each VM has its required NAT network on adapter 1 and then has an adapter that is on a host-only shared network that they can all talk over.   On this then I can set IPs as needed to do other simple configurations successfully in a set network design.   

Every time I end up destroying and re-creating the environments I have another new host-only adapter created.    Right now in my testing I'm up around 15 Host-only adapters in my system which is a tad much.

Is there any way to say "use the first/second or third" private_network (Host-Only Adapter) so vagrant doesn't keep creating new adapters?

Example Vagrantfile:


# -*- mode: ruby -*-
# vi: set ft=ruby :
# Every Vagrant development environment requires a box. You can search for # boxes at <a href="https://atlas.hashicorp.com/search" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fatlas.hashicorp.com%2Fsearch\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGZifqytQFDe-BAZvPQ4MTtlWTiow&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fatlas.hashicorp.com%2Fsearch\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGZifqytQFDe-BAZvPQ4MTtlWTiow&#39;;return true;">https://atlas.hashicorp.com/search.


BOX_IMAGE
= "centos/7"
NODE_COUNT
= 1
Vagrant.configure("2") do |config|  
 config
.vm.define "master" do |subconfig|    
 subconfig
.vm.box = BOX_IMAGE    
 subconfig
.vm.hostname = "master"    
 subconfig
.vm.network :private_network, ip: "10.0.0.10"  
 
#subconfig.vm.network :public_network
 
end    


 
(1..NODE_COUNT).each do |i|    
 config
.vm.define "node#{i}" do |subconfig|      
 subconfig
.vm.box = BOX_IMAGE      
 subconfig
.vm.hostname = "node#{i}"      
 subconfig
.vm.network :private_network, ip: "10.0.0.#{i + 10}"    
 
end  
 
end  
end

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/3e4cda11-c590-44f5-8daa-53a327517be5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.