Using CIDR notation for IP assignment

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

Using CIDR notation for IP assignment

Tyler Auerbeck
I have a few projects that I work on locally that require hosts having a few NIC's assigned. Currently I'm creating these manually and then just assigning static IP addresses to these hosts in my Vagrantfile. What I'm curious about is whether there is any functionality in Vagrant that exists that would just allow me to use a cidr block to do something like this:

  config.vm.define "x" do |x| 
      x.vm.box = "centos"
      x.vm.hostname = "k8sc1.localdomain"
      x.vm.network "private_network", ip: "192.168.0.12"
      x.vm.network "private_network", cidr: "10.240.0.0/24"
  end

This way my Vagrantfile can become more generalized because I really don't care what the IP address is, just that it gets different NIC's assigned within certain blocks. If this is something that is already possible, let me know what I missed.


--
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/e482a94c-94ff-4ab5-b2d2-afd6840a86ef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Using CIDR notation for IP assignment

Alvaro Miranda Aguilera
hello

what about you create a network in virtualbox say mynetwork, enable dhcp and give it a range.

then you can just use:


config.vm.network "private_network",
    virtualbox__intnet: "mynetwork"

Alvaro

On Sun, Nov 26, 2017 at 6:17 PM, Tyler Auerbeck <[hidden email]> wrote:
I have a few projects that I work on locally that require hosts having a few NIC's assigned. Currently I'm creating these manually and then just assigning static IP addresses to these hosts in my Vagrantfile. What I'm curious about is whether there is any functionality in Vagrant that exists that would just allow me to use a cidr block to do something like this:

  config.vm.define "x" do |x| 
      x.vm.box = "centos"
      x.vm.hostname = "k8sc1.localdomain"
      x.vm.network "private_network", ip: "192.168.0.12"
      x.vm.network "private_network", cidr: "10.240.0.0/24"
  end

This way my Vagrantfile can become more generalized because I really don't care what the IP address is, just that it gets different NIC's assigned within certain blocks. If this is something that is already possible, let me know what I missed.


--
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/e482a94c-94ff-4ab5-b2d2-afd6840a86ef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alvaro

--
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/CAHqq0ewT4yN7RT67rTaoWS3Yi%3D8Z_QO5DkNL6RJswd-1ckZhbA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.