Vagrant issue - able to communicate between private networks

316 views Asked by At

I've run into an issue while using Vagrant.

I have to boxes and I've configured them to be part of different virtualbox internal networks (relevant config below):

Dataplane port

  vsrx1.vm.network 'private_network', auto_config: false, nic_type: '82540EM', virtualbox__intnet: **"seg1"**
  end

Dataplane port

  vsrx3.vm.network 'private_network', auto_config: false, nic_type: '82540EM', virtualbox__intnet: **"seg2"**
  end

However, the hosts are able to communicate with one another (they have IPs from the same subnet), although they belong to different private networks.

Does anyone know why?

Thanks, Cristian

1

There are 1 answers

1
Frederic Henri On

From the vagrant book

NAT Requirement As the First Network Interface

With VirtualBox, Vagrant requires the first network device attached to the virtual machine to be a NAT device. The NAT device is used for port forwarding, which is how Vagrant gets SSH access to the virtual machine.

Therefore, any host-only or bridged networks will be added as additional network devices and exposed to the virtual machine as “eth1,” “eth2,” and so on. “eth0” or “en0” is generally always the NAT device.

It isn’t currently possible to override this requirement, but it is important to understand that it is in place.

this first network interface is not set from Vagrantfile, if you ssh into the VM and check the network of the VM, you will see this first network interface used by the host to communicate with the VM (so you can ssh)