Closed mirzawaqasahmed closed 8 years ago
You're gonna need to provide some more information, such as your VirtualBox networking configuration and the configuration of your VMs, if you expect to get any useful suggestions.
As a quick test, make sure that the MAC addresses of the network adapters in the VMs are all different, especially if you copied the VMs.
Thank you for the reply. Below is the snapshot of my "vagrantfile".... also I confirm that each eth0 (NAT) interface has unique MAC address... any further options to look for???
Vagrant.configure(2) do |config|
config.ssh.username = "vagrant"
config.ssh.password = "vagrant"
config.ssh.insert_key = true
config.vm.define "ansible" do |ansible|
ansible.vm.box = "ansible-1.9.4-w_cumulus"
ansible.vm.hostname = "Provisioner"
end
end
Vagrant.configure(2) do |config|
config.ssh.username = "vagrant"
config.ssh.password = "vagrant"
config.vm.define "spine111" do |spine111|
spine111.vm.box = "cumulus-vx-2.5.3"
spine111.vm.hostname = "Spine-111"
# Internal network for switchports interfaces.
spine111.vm.network "private_network", virtualbox__intnet: "S111L131P1P1"
spine111.vm.network "private_network", virtualbox__intnet: "S111L132P2P1"
spine111.vm.network "private_network", virtualbox__intnet: "S111L141P3P3"
spine111.vm.network "private_network", virtualbox__intnet: "S111L142P4P3"
spine111.vm.network "private_network", virtualbox__intnet: "S111S112P5P5_CLAG"
spine111.vm.network "private_network", virtualbox__intnet: "S111S112P6P6_CLAG"
end
config.vm.define "spine112" do |spine112|
spine112.vm.box = "cumulus-vx-2.5.3"
spine112.vm.hostname = "Spine-112"
# Internal network for switchports interfaces.
spine112.vm.network "private_network", virtualbox__intnet: "S112L131P1P2"
spine112.vm.network "private_network", virtualbox__intnet: "S112L132P2P2"
spine112.vm.network "private_network", virtualbox__intnet: "S112L141P3P4"
spine112.vm.network "private_network", virtualbox__intnet: "S112L142P4P4"
spine112.vm.network "private_network", virtualbox__intnet: "S111S112P5P5_CLAG"
spine112.vm.network "private_network", virtualbox__intnet: "S111S112P6P6_CLAG"
end
config.vm.define "spine121" do |spine121|
spine121.vm.box = "cumulus-vx-2.5.3"
spine121.vm.hostname = "Spine-121"
# Internal network for switchports interfaces.
spine121.vm.network "private_network", virtualbox__intnet: "S121L141P1P1"
spine121.vm.network "private_network", virtualbox__intnet: "S121L142P2P1"
spine121.vm.network "private_network", virtualbox__intnet: "S121L131P3P3"
spine121.vm.network "private_network", virtualbox__intnet: "S121L132P4P3"
spine121.vm.network "private_network", virtualbox__intnet: "S121S122P5P5_CLAG"
spine121.vm.network "private_network", virtualbox__intnet: "S121S122P6P6_CLAG"
end
config.vm.define "spine122" do |spine122|
spine122.vm.box = "cumulus-vx-2.5.3"
spine122.vm.hostname = "Spine-122"
# Internal network for switchports interfaces.
spine122.vm.network "private_network", virtualbox__intnet: "S122L141P1P2"
spine122.vm.network "private_network", virtualbox__intnet: "S122L142P2P2"
spine122.vm.network "private_network", virtualbox__intnet: "S122L131P3P4"
spine122.vm.network "private_network", virtualbox__intnet: "S122L132P4P4"
spine122.vm.network "private_network", virtualbox__intnet: "S121S122P5P5_CLAG"
spine122.vm.network "private_network", virtualbox__intnet: "S121S122P6P6_CLAG"
end
config.vm.define "leaf131" do |leaf131|
leaf131.vm.box = "cumulus-vx-2.5.3"
leaf131.vm.hostname = "Leaf-131"
# Internal network for switchports interfaces.
leaf131.vm.network "private_network", virtualbox__intnet: "S111L131P1P1"
leaf131.vm.network "private_network", virtualbox__intnet: "S112L131P1P2"
leaf131.vm.network "private_network", virtualbox__intnet: "S121L131P3P3"
leaf131.vm.network "private_network", virtualbox__intnet: "S122L131P3P4"
leaf131.vm.network "private_network", virtualbox__intnet: "L131L132P5P5_CLAG"
leaf131.vm.network "private_network", virtualbox__intnet: "L131L132P6P6_CLAG"
leaf131.vm.network "private_network", virtualbox__intnet: "L131H1P7E1"
end
config.vm.define "leaf132" do |leaf132|
leaf132.vm.box = "cumulus-vx-2.5.3"
leaf132.vm.hostname = "Leaf-132"
# Internal network for switchports interfaces.
leaf132.vm.network "private_network", virtualbox__intnet: "S111L132P2P1"
leaf132.vm.network "private_network", virtualbox__intnet: "S112L132P2P2"
leaf132.vm.network "private_network", virtualbox__intnet: "S121L132P4P3"
leaf132.vm.network "private_network", virtualbox__intnet: "S122L132P4P4"
leaf132.vm.network "private_network", virtualbox__intnet: "L131L132P5P5_CLAG"
leaf132.vm.network "private_network", virtualbox__intnet: "L131L132P6P6_CLAG"
leaf132.vm.network "private_network", virtualbox__intnet: "L132H1P7E2"
end
config.vm.define "leaf141" do |leaf141|
leaf141.vm.box = "cumulus-vx-2.5.3"
leaf141.vm.hostname = "Leaf-141"
# Internal network for switchports interfaces.
leaf141.vm.network "private_network", virtualbox__intnet: "S121L141P1P1"
leaf141.vm.network "private_network", virtualbox__intnet: "S122L141P1P2"
leaf141.vm.network "private_network", virtualbox__intnet: "S111L141P3P3"
leaf141.vm.network "private_network", virtualbox__intnet: "S112L141P3P4"
leaf141.vm.network "private_network", virtualbox__intnet: "L141L142P5P5_CLAG"
leaf141.vm.network "private_network", virtualbox__intnet: "L141L142P6P6_CLAG"
leaf141.vm.network "private_network", virtualbox__intnet: "L141H2P7E1"
end
config.vm.define "leaf142" do |leaf142|
leaf142.vm.box = "cumulus-vx-2.5.3"
leaf142.vm.hostname = "Leaf-142"
# Internal network for switchports interfaces.
leaf142.vm.network "private_network", virtualbox__intnet: "S121L142P2P1"
leaf142.vm.network "private_network", virtualbox__intnet: "S122L142P2P2"
leaf142.vm.network "private_network", virtualbox__intnet: "S111L142P4P3"
leaf142.vm.network "private_network", virtualbox__intnet: "S112L142P4P4"
leaf142.vm.network "private_network", virtualbox__intnet: "L141L142P5P5_CLAG"
leaf142.vm.network "private_network", virtualbox__intnet: "L141L142P6P6_CLAG"
leaf142.vm.network "private_network", virtualbox__intnet: "L142H2P7E2"
end
end
Vagrant.configure(2) do |config|
config.ssh.username = "vagrant"
config.ssh.password = "vagrant"
config.ssh.insert_key = true
config.vm.define "host1" do |host1|
host1.vm.box = "hashicorp/precise32"
host1.vm.hostname = "Host-1"
# Internal network for switchports interfaces.
host1.vm.network "private_network", virtualbox__intnet: "L131H1P7E1"
host1.vm.network "private_network", virtualbox__intnet: "L132H1P7E2"
end
config.vm.define "host2" do |host2|
host2.vm.box = "hashicorp/precise32"
host2.vm.hostname = "Host-2"
# Internal network for switchports interfaces.
host2.vm.network "private_network", virtualbox__intnet: "L141H2P7E1"
host2.vm.network "private_network", virtualbox__intnet: "L142H2P7E2"
end
end
Vagrant itself doesn't assign the IP address for the NAT device. This is up to VirtualBox. So I'm going to close this as a "VirtualBox issue" unless you can offer some input on how we can avoid it in Vagrant. Sorry!
Hi
Did you find a resolution to this issue? I am having the same problem.
All the VirtualBox VM's in a multi vm vagrant file come up with the same ipaddress in the first interface (10.0.2.15) by default. When I use private_network with a hard coded ip address it shows up as another interface.
This confuses some software (e.g. Even with correct entries in the hosts file Chef server tries to connect to the magic ip (10.0.2.15) instead of the one I assigned and configured. I guess because the chef-node reports the magic ip as its own.)
Is there a way around this?
thanks pj
Here is one of solution for your request. vagrant NAT try to assign like this format 10.0.0.15. So if you try to subnet 192.168.0.0/16. vagrant NAT assign 192.168.0.15..
#===============#
# Cumulus nodes #
#===============#
#Ansible-CML01
config.vm.define "ansible-CML01" do |leaf|
leaf.vm.box = "CumulusCommunity/cumulus-vx"
leaf.vm.provider "virtualbox" do |vb|
vb.name = "Ansible-CML01(github_SysNet4Admin)"
vb.customize ['modifyvm', :id, '--macaddress1', '080027000051']
vb.customize ['modifyvm', :id, '--natnet1', '10.0.51.0/24']
end
leaf.vm.host_name = "ansible-CML01"
leaf.vm.network "public_network", ip: "192.168.1.51"
#leaf.vm.network "private_network", virtualbox__intnet: "swp2", auto_config: false
#leaf.vm.network "private_network", virtualbox__intnet: "swp3", auto_config: false
#leaf.vm.network "private_network", virtualbox__intnet: "swp4", auto_config: false
#leaf.vm.network "private_network", virtualbox__intnet: "swp5", auto_config: false
leaf.vm.network "forwarded_port", guest: 22, host: 60051, auto_correct: true, id: "ssh"
leaf.vm.synced_folder "../data", "/vagrant", disabled: true
end
#Ansible-CML02
config.vm.define "ansible-CML02" do |leaf|
leaf.vm.box = "CumulusCommunity/cumulus-vx"
leaf.vm.provider "virtualbox" do |vb|
vb.name = "Ansible-CML02(github_SysNet4Admin)"
vb.customize ['modifyvm', :id, '--macaddress1', '080027000052']
vb.customize ['modifyvm', :id, '--natnet1', '10.0.52.0/24']
end
leaf.vm.host_name = "ansible-CML02"
leaf.vm.network "public_network", ip: "192.168.1.52"
#leaf.vm.network "private_network", virtualbox__intnet: "swp2", auto_config: false
#leaf.vm.network "private_network", virtualbox__intnet: "swp3", auto_config: false
#leaf.vm.network "private_network", virtualbox__intnet: "swp4", auto_config: false
#leaf.vm.network "private_network", virtualbox__intnet: "swp5", auto_config: false
leaf.vm.network "forwarded_port", guest: 22, host: 60052, auto_correct: true, id: "ssh"
leaf.vm.synced_folder "../data", "/vagrant", disabled: true
end
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
All, I am setting up a multi-vm env in vagrant and when I start the VMs all are getting same IP "10.0.2.15" on their eth0. vm-1 gets 10.0.2.15 vm-2 gets 10.0.2.15 vm-3 gets 10.0.2.15 I want to have different IPs on the NAT interface of each vm. How can this be fixed?
any help will be appreciated.
thanks