How to assign ip addresses to multiple vm's using Vagrant

971 views
Skip to first unread message

varun umesh

unread,
Aug 4, 2014, 10:36:30 AM8/4/14
to vagra...@googlegroups.com
I am trying to boot 3 vm's using Vagrant and i want to know how i can assign ip address to these vm's using Vagrant. I just want to understand what are the changes required to be done for my Vagrantfile.

Thanks!

-varun

Alvaro Miranda Aguilera

unread,
Aug 4, 2014, 2:22:49 PM8/4/14
to vagra...@googlegroups.com
Hello,

The networking on single machine or multi-machine should be the same.

http://docs.vagrantup.com/v2/networking/index.html

you can have private networks:
http://docs.vagrantup.com/v2/networking/private_network.html

or public networks:
http://docs.vagrantup.com/v2/networking/public_network.html

Can you elaborate a bit more on what you require?

Thanks,
alvaro.



--
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 vagrant-up+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

varun umesh

unread,
Aug 4, 2014, 2:51:26 PM8/4/14
to vagra...@googlegroups.com
Hi,

Thanks for your reply!

Here is what i am trying to do:

I want to bring up 2 virtual machines with static ip's.

I just want to know how i could modify my Vagrant file to do the same?

Can i do it the way below:

Vagrant.configure('2') do |config|

  config.vm.define :first do |node|
    node.vm.box = "ubuntu-12.04-server-i386"
    node.vm.network :private_network, :ip => 'xxx.xxx.xxx.xxx'
  end

  config.vm.define :second do |node|
    node.vm.box = "ubuntu-12.04-server-i386"
    node.vm.network :private_network, :ip => 'xxx.xxx.xxx.xxx'
    end
end
Is this the correct approach? Is there a better method to do this?

Note: I am using the vagrant-vsphere plugin to do this [https://github.com/nsidc/vagrant-vsphere]

Thanks!

Alvaro Miranda Aguilera

unread,
Aug 4, 2014, 2:56:17 PM8/4/14
to vagra...@googlegroups.com
Hello,

I did reply the other email.

It seems in the vspehere plugin there are some pre-requirements, so please review the other email and check the blog post I did suggest, since seems that cover pretty much everything to get the network setup.

Alvaro.
Reply all
Reply to author
Forward
0 new messages