I have a VirtualBox (v4.1.8) VM that is automatically assigned with an IP in the 10.0.x.x
range via DHCP.
Can I change it to use the 192.168.x.x
range instead?
I have a VirtualBox (v4.1.8) VM that is automatically assigned with an IP in the 10.0.x.x
range via DHCP.
Can I change it to use the 192.168.x.x
range instead?
Thanks to @RelaXNow, here is the answer to the question:
VBoxManage modifyvm "NameOfVM" --natnet1 "192.168/16"
sudo vboxreload
on the host (VirtualBox 5.1.26).
Providing I have understood the question, if you check chapter 6 of the manual it says:
In the VirtualBox graphical user interface, you can configure all these items in the global settings via "File" -> "Settings" -> "Network", which lists all host-only networks which are presently in use. Click on the network name and then on the "Edit" button to the right, and you can modify the adapter and DHCP settings.
Yes it can be changed. There is documentation on it here:
http://www.virtualbox.org/manual/ch08.html#vboxmanage-dhcpserver
It's handled through the VBoxManage dhcpserver
command.
You usually don't need to modify VirtualBox DHCP address range. This network is internal and only exists between your VM and the VirtualBox application. There is no routing involved but just NAT.
Should you want to allow accessing your virtual machine from the outside while staying in the default NAT mode, it is possible to selectively open ports (port forwarding).
For example, to allow access to your internal ssh server through the 2022 port, use this command:
VBoxManage modifyvm "NameOfVM" --natpf1 "guestssh,tcp,,2022,,22"