6

I have a VM running on Windows using Virtual Box and Vagrant.

How do I assign a local network IP address to this VM using a local DHCP?

The requirement is for this VM to be visible on the local network and to get the IP address from the local network's DHCP server.

1
  • You must enable Bridged Adapter under Network, instead of NAT. Commented Jul 2, 2015 at 13:37

2 Answers 2

1

As MariusMatutiae mentioned, you must switch the Virtual Network from NAT to Bridged. This will allow the VM to interact with other "real" devices on the network.

1

Use the following in your Vagrantfile. It will use DHCP by default.

config.vm.network "public_network"

Find the new IP address with

vagrant ssh
ifconfig
ip address   # CentOS 7

https://www.vagrantup.com/docs/networking/public_network.html

1
  • set ssh_info_public = true then vagrant ssh-info would show the desired ip address
    – cdarlint
    Commented Jan 25, 2019 at 2:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .