Configuring VirtualBox Host‑Only Network for a Vagrant Virtual Machine
This guide explains how to view the VirtualBox host‑only network, set a matching IP address in the Vagrantfile, reload the VM, and verify connectivity between the host and the virtual machine using ping commands.
Configuring VirtualBox Host‑Only Network
1. View VirtualBox Host‑Only Network
The local VirtualBox network address is 192.168.56.1 . Choose an IP in the same subnet for the VM, for example 192.168.56.10 .
2. Configure the VM IP Address
Open the Vagrant configuration file C:\Users\Administrator\Vagrantfile and modify the network line.
# config.vm.network "private_network", ip: "192.168.33.10"
修改为
config.vm.network "private_network", ip: "192.168.56.10"3. Reload the Virtual Machine
vagrant reload4. Verify the VM IP Address
The VM now shows the IP address 192.168.56.10 , which matches the configuration.
5. Test Host‑to‑VM Connectivity
Run ping 192.168.56.10 on the host; the VM should respond.
6. Test VM‑to‑Host Connectivity
Inside the VM, run ping 192.168.10.160 ; the host should be reachable.
Wukong Talks Architecture
Explaining distributed systems and architecture through stories. Author of the "JVM Performance Tuning in Practice" column, open-source author of "Spring Cloud in Practice PassJava", and independently developed a PMP practice quiz mini-program.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.