why is NAT apdater network still active even I just configure my VM to use public network? [closed]

StackOverflow https://stackoverflow.com/questions/23123468

  •  05-07-2023
  •  | 
  •  

Question

I am now using Vagrant to manage my virtual machine. I configure the VM to use the 'public_network'

my Vagrantfile is as follows:

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  config.vm.box = "precise32"

  config.vm.network "public_network"

  config.vm.synced_folder "data", "/home/vagrant/data"

  config.vm.provider "virtualbox" do |vb|

    vb.customize ["modifyvm", :id, "--memory", "1024"]
  end

end

But when I use 'vagrant up' to start my virtual machine, I find it still use the NAT adapter. Why does that happen?

end

Was it helpful?

Solution

Check this Vagrant keeps creating unwanted network interfaces

In short

Vagrant always uses NAT (VirtualBox NAT networking mode), which allow you to vagrant ssh into the box (port forwarding rules - host 2222 <=> guest 22).

So in your case, you'll end up having 2 NICs, eth0 for NAT and eth1 for Bridged (Public Network in Vagrant term).

It's just by design :-D

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top