How to get back IP addresses for Vagrant provisioned VM's ?

3,813 views
Skip to first unread message

Mark Carter

unread,
Jul 15, 2015, 6:14:05 PM7/15/15
to vagra...@googlegroups.com
Hey,
Sorry if this is an RTFM, but couldn't find the answer.
We are using Vagrant to automate the provisioning of 3 VM's on VMware fusion in order to setup a local dev environment. 
Once the 3 boxes are provisioned, I need to somehow get back the IP address assigned to each of the VM's so they can be used by an automated script to connect to each of the boxes and install packages.
Is there a programatic way to get back the dynamically assigned IP for each VM provisioned by Vagrant ?
Same question apply when using either Vagran + Fusion and Vagrant + VirtualBox.
Guidance appreciated,
Mark

Alvaro Miranda Aguilera

unread,
Jul 15, 2015, 7:07:03 PM7/15/15
to vagra...@googlegroups.com
Hello,

Easiest trick is let the first ip on eth0 be used by vagrant

and add a 2nd nic with a known ip that you can use for that

For private networking (not available on the LAN)

config.vm.network "private_network", ip: "192.168.50.4"

If you need this from the LAN, you can use a public_network

https://docs.vagrantup.com/v2/networking/public_network.html

Will this helps?
> --
> 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 vagrant-up+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vagrant-up/73ba57f8-45ee-4842-9101-35ab3e112b3e%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages