I'm trying to configure static IPs on 2 vagrant boxes so they can communicate with each other. With the following config, the "db" node comes up with an eth1 and eth2 with 192.168.50.4 and 192.168.50.5 respectively. The second "web" node, correctly brings up only an eth1 with 192.168.50.5. Why does the first node have both addresses?
Vagrant.configure("2") do |config|
config.vm.provision "shell", inline: "echo Hello"
config.vm.define "web" do |web|
web.vm.box = "ubuntu/trusty64"
config.vm.network "private_network", ip: "192.168.50.5"
end
config.vm.define "db" do |db|
db.vm.box = "ubuntu/trusty64"
config.vm.network "private_network", ip: "192.168.50.4"
end
end
I've just tested it and it works for me. Here's the code:
Edit:
Resulting IP configuration:
Going to take a different track on this one. I use the vagrant plugin vagrant-hostmanager. You can install it with
vagrant plugin install vagrant-hostmanager
and my vagrant file looks like the below. I can now ping/ssh/other by hostname (e.g. ssh nfs1).