I set the host name of the virtual machine. I want to access the host name of the virtual machine on this machine. I can edit the hosts file on this machine manually. A more convenient way is to use the vagant host manager plug-in p>
Plug in address
https://github.com/devopsgroup-io/vagrant-hostmanager39
Install plug-ins
vagrant plugin install vagrant-hostmanager
Return:
Installing the 'vagrant-hostmanager' plugin. This can take a few minutes...
Installed the plugin 'vagrant-hostmanager (1.8.2)'!
Using plug-ins
In the vagrantfile, you can add the following configuration for the virtual machine:
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.manage_guest = true
When defining a virtual machine, you can add a host name to set the host name of the virtual machine
config.vm.define "node1" do |node1|
node1.vm.network "private_network", ip: "192.168.33.11"
node1.vm.hostname="node1"
end
After starting the virtual machine, the host name of the virtual machine will be automatically updated, and the contents of the hosts file on the local host will also be updated p>
Or we can manually update and execute the command:
vagrant hostmanager
Return:
[manager1] Updating /etc/hosts file...
[worker1] Updating /etc/hosts file...
[worker2] Updating /etc/hosts file...
Similar Posts:
- Vagrant up Error:unable to mount VirtualBox shared folders
- Vagrant: How to Change the Default SSH Port
- The network of vagrant manual – public network
- virtualbox+vagrant -2(command cli)-4-vagrant global-status Commands
- NPM install error reporting in Windows: solution to operation not permitted, rename
- windows homestead vagrant up: Warning: Authentication failure. Retrying…
- How to Solve Vagrant Start Error
- [Solved] Stderr: VBoxManage: error: Failed to load unit ‘HGCM’ (VERR_TOO_MUCH_DATA)
- When executing the vacuum SSH command, ‘SSH’ executable not found in any directions in the% path%. Solution to the prompt
- Openstack build virtual machine Error: No valid host was found. There are not enough hosts available