DHCP

The fastest and easiest way to get started with public networking is to allow DHCP to assign an IP address to the Vagrant machine:

  1. In your Vagrantfile, use config.vm.network "public_network" to get it started.
There is no need to specify the type parameter like you would in the private networking DHCP configuration.
  1. Run the vagrant up --provision command to get the Vagrant machine up and running. As we are using a public network, you will be prompted to select a bridged network interface. Depending on your requirements and some possible trial and error, choose one. I will select the first option, 1) en0: (Wi-Fi) Airport:
  1. To find out the IP address of the newly-upped Vagrant machine, we must SSH into the machine itself. Run the vagrant ssh command. Once in the Vagrant machine, run the ifconfig command (this networking command will depend on the operating system).

There is an optional parameter that can be supplied when using DHCP. This is the DHCP assigned default route. In certain cases, this option may be required.

  1. An example of this parameter would be adding config.vm.network "public_network", use_dhcp_assigned_default_route: true into your Vagrantfile.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.162.110