Hello,
I've been setting up Vagrant VMs for a WordPress build that works fine when
I just have the one VM using an auto assigned IP. What I want to do is have
the ability to fire up multiple VMs and I need each VM to have a separate
IP that I can manage.
The IP address assignment is controlled via a batch file that creates the
Vagrant file. However, I can't set the private IP of the VM.
This is the line in my Vagrant file: config.vm.network "private_network",
ip: "192.168.99.2", :netmask => '255.255.255.0', auto_config: false
I get a VirtualBox host only network created with IP 192.168.99.1/24, but
the Centos VM gets an IP address of 10.0.2.15/24.
Completely stuck.
Any help appreciated,
David.
Here's my vagrant file:
Vagrant.configure("2") do |config|
vagrant_version = Vagrant::VERSION.sub(/^v/, '')
config.vm.box = "wordpress.php7"
config.vm.box_url = "http://mysite.local/vagrant/" +
config.vm.box + ".box"
config.vm.network :forwarded_port, guest: 22, host: 22, id:
'ssh'
config.vm.hostname = "wordpress.local"
config.vm.network "private_network", ip: "192.168.99.2",
:netmask => '255.255.255.0', auto_config: false
config.ssh.host = "192.168.99.2"
config.ssh.port = "22"
config.vm.synced_folder "../../", "/vagrant", nfs: true
config.vm.synced_folder "../../www/", "/var/www/html",
:mount_options => [ "dmode=777", "fmode=777" ]
config.vm.synced_folder "../../dbbackup/", "/dbbackup",
:mount_options => [ "dmode=777", "fmode=777" ]
config.vm.synced_folder "../../dbupload/", "/dbupload",
:mount_options => [ "dmode=777", "fmode=777" ]
config.vm.synced_folder "../../wwwbackup/", "/wwwbackup",
:mount_options => [ "dmode=777", "fmode=777" ]
config.vm.synced_folder "../../wwwupload/", "/wwwupload",
:mount_options => [ "dmode=777", "fmode=777" ]
config.vm.synced_folder "../../scripts/", "/scripts",
:mount_options => [ "dmode=777", "fmode=777" ]
config.vm.provider "virtualbox" do |v|
v.name = "[2]wordpress.local"
v.customize ["modifyvm", :id,
"--natdnshostresolver1", "on"]
v.customize ["modifyvm", :id, "--cpus", "2"]
v.memory = 1024
end
config.vm.provision "shell", inline: "yum clean all"
config.vm.provision "shell", inline: "yum update -y"
config.vm.provision "puppet" do |puppet|
puppet.manifests_path = ["vm",
"/vagrant/server/vagrant/manifests"]
puppet.manifest_file = "default.pp"
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vagrant-up/4d2c0913-7930-4d1e-8291-f25eb16672fa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.