My blog post on introduction to vagrant

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

My blog post on introduction to vagrant

Adam Fields
I thought this might be of interest to the group - I wrote up our experiences getting started with vagrant:

http://workstuff.tumblr.com/post/50911984233



                                - Adam
----------
If you liked this email, you might also like:
"Some tips on getting started with Vagrant and Chef"
-- http://workstuff.tumblr.com/post/50911984233
"I guess I don’t have much “personal” stuff to write these days."
-- http://www.aquick.org/blog/2013/04/08/i-guess-i-dont-have-much-personal-stuff-to-write-these-days/
"Shiva's cosmic dance has no purpose."
-- http://www.flickr.com/photos/fields/8809545797/
"@fields: @barmstrong It really adds a lot of mystique to the Jedi in the first..."
-- https://alpha.app.net/fields/post/6063220
----------
** I design intricate-yet-elegant processes for user and machine problems.
** Some of what I do: http://workstuff.tumblr.com/post/70505118/aboutworkstuff

[ http://www.adamfields.com/resume.html ].. Experience
[ http://www.morningside-analytics.com ] .. Latest Venture

--
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].
For more options, visit https://groups.google.com/groups/opt_out.


Reply | Threaded
Open this post in threaded view
|

Static IP on bridged network

James Jelinek
I have a very simple Vagrantfile setup that sets up multiple machines with Vagrant.

What I'm trying to do is assign a static IP on the bridged network so I don't have to do DHCP reservation on the router.

Here's what my Vagrantfile looks like:

Vagrant.configure("2") do |config|
config.vm.define :web do |web|
    web.vm.box = "web"
    web.vm.hostname = "web"
    web.vm.network :public_network, :bridge => "en0: Wi-Fi (AirPort)"
  end

  config.vm.define :db do |db|
    db.vm.box = "precise32"
    db.vm.hostname = "db"
    db.vm.network :public_network, :bridge => "en0: Wi-Fi (AirPort)"
  end

  config.vm.define :web2 do |web2|
    web2.vm.box = "precise32"
    web2.vm.hostname = "web2"
    web2.vm.network :public_network, :bridge => "en0: Wi-Fi (AirPort)"
  end

  config.vm.define :web3 do |web3|
    web3.vm.box = "precise32"
    web3.vm.hostname = "web3"
    web3.vm.network :public_network, :bridge => "en0: Wi-Fi (AirPort)"
  end
end

I'm passing :bridge => "en0: Wi-Fi (Airport)" to the vm.network method to automatically bridge the interface to my LAN.

I'd like to statically assign an IP address to each VM.

I tried doing this via /etc/network/interfaces and statically assigning the IP info there.  Initially it worked as soon as I did /etc/init.d/networking restart however upon vagrant reload it lost the configuration and went back to using dhclient to pick up the IP address and Vagrant overwrote the /etc/network/interfaces file.

What would be the best way to assign a static IP/GW/DNS/etc to the bridged interface on boot?

I'm a bit new to Vagrant so any help is appreciated :)

-James

--
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].
For more options, visit https://groups.google.com/groups/opt_out.


Reply | Threaded
Open this post in threaded view
|

Re: Static IP on bridged network

James Jelinek
Ok, so I may have solved my own problem but not sure it's the best way to do it.

I wrote a simple script and named it web3.sh and included the following:

sudo /sbin/ifconfig eth1 192.168.1.200 netmask 255.255.255.0 up
sudo /sbin/route add default gw 192.168.1.1 eth1

Then I used a provisioner to execute at boot:

web3.vm.provision :shell, :path => "web3.sh"

This assigned the static IP on my bridged network and works each time I vagrant reload.

Any cleaner ways to do this, or is a decent solution?  Anything I'm missing here?

-James


On May 26, 2013, at 8:07 AM, James Jelinek <[hidden email]> wrote:

> I have a very simple Vagrantfile setup that sets up multiple machines with Vagrant.
>
> What I'm trying to do is assign a static IP on the bridged network so I don't have to do DHCP reservation on the router.
>
> Here's what my Vagrantfile looks like:
>
> Vagrant.configure("2") do |config|
> config.vm.define :web do |web|
>    web.vm.box = "web"
>    web.vm.hostname = "web"
>    web.vm.network :public_network, :bridge => "en0: Wi-Fi (AirPort)"
>  end
>
>  config.vm.define :db do |db|
>    db.vm.box = "precise32"
>    db.vm.hostname = "db"
>    db.vm.network :public_network, :bridge => "en0: Wi-Fi (AirPort)"
>  end
>
>  config.vm.define :web2 do |web2|
>    web2.vm.box = "precise32"
>    web2.vm.hostname = "web2"
>    web2.vm.network :public_network, :bridge => "en0: Wi-Fi (AirPort)"
>  end
>
>  config.vm.define :web3 do |web3|
>    web3.vm.box = "precise32"
>    web3.vm.hostname = "web3"
>    web3.vm.network :public_network, :bridge => "en0: Wi-Fi (AirPort)"
>  end
> end
>
> I'm passing :bridge => "en0: Wi-Fi (Airport)" to the vm.network method to automatically bridge the interface to my LAN.
>
> I'd like to statically assign an IP address to each VM.
>
> I tried doing this via /etc/network/interfaces and statically assigning the IP info there.  Initially it worked as soon as I did /etc/init.d/networking restart however upon vagrant reload it lost the configuration and went back to using dhclient to pick up the IP address and Vagrant overwrote the /etc/network/interfaces file.
>
> What would be the best way to assign a static IP/GW/DNS/etc to the bridged interface on boot?
>
> I'm a bit new to Vagrant so any help is appreciated :)
>
> -James
>

--
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].
For more options, visit https://groups.google.com/groups/opt_out.