• CentOS 7 VM -
  • Windows Server 2012 R2 VM -

Goal - Ping each other; communicate with each other

Problem - Cannot ping each other; communicate with each other

On the CentOS VM, I have auto_config turned off because Vagrant was having trouble automatically changing the IP for me. So I made Vagrant recognize it as and then changed the network manually on the VM.

On the Windows VM, Vagrant defaulted the IP address to

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|

  config.vm.define "master" do |master|
    master.vm.box = "centos/7"
    master.vm.network "private_network", ip: "", auto_config: false
    master.vm.box      = "centos_7_v2"
    master.vm.hostname = "master.local.com"
    master.vm.provider "virtualbox" do |v|
      v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]

  config.vm.define "nodeone" do |nodeone|
    nodeone.vm.box = "windows_2012_r2_standard"
    nodeone.vm.hostname = "nodeone.local.com"
    nodeone.vm.provider "virtualbox" do |v|
      v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]


I have the configuration --natdnshostresolver1 added to both VMs, and then added the following into my own hosts file (on my Mac). nodeone.local.com master.local.com

I finally figured it out. Apparently, you just set the IP address to be in the same subnet and then add then follow virtualbox__intnet: true setting per https://www.vagrantup.com/docs/virtualbox/networking.html

# Master
master.vm.network "private_network", ip: "",
  virtualbox__intnet: true

# Node
nodeone.vm.network "private_network", ip: "",
  virtualbox__intnet: true

As stated by @jeffrey-wen, the solution is to add virtual_box__intnet: true to the inventory file. It should be noted that in doing so, you may have trouble pinging or sshing into your Vagrant boxes which are now on a new local network (as detailed in this Ansible issue).

The solution for me was to add -c local to any command I ran. -c informs Ansible of the connection type to use and defaults to smart which sometimes doesn't work correctly.

Sorry for posting this as an answer - I don't have enough reputation yet to post it as a comment ¯\_(ツ)_/¯

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.