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?

  • 2
    Could someone enlighten me as to why I'm getting a downvote? It may be a beginner question, but I am a beginner with VirtualBox and I had to google a fair bit to get to the answer, which is: VBoxManage modifyvm "NameOfVM" --natnet1 "192.168/16" Mar 8, 2012 at 13:43
  • I can't, not enough rep, have to wait a day... if you could post it I could accept and the next guy will have an easier time :). Mar 8, 2012 at 13:46
  • In fairness I was looking for this feature a year or so ago - the specific answer wasn't immediately available. A bit unfair to downvote, especially without comment.
    – Coops
    Mar 8, 2012 at 13:47
  • 4
    It's a tradeoff...encouraging feedback through voting, or require reasons and questions don't get downvotes. Personally I think it's a little rude not to leave a reason, as it doesn't enlighten users to better hone question skills or ask questions appropriate to the community, but that's my opinion. Mar 8, 2012 at 14:14
  • 1
    May be those who downvoted were questioning the fact this DHCP address was conflicting with your intranet assuming there should be no routing but NAT between the latter and the internal network used by VirtualBox.
    – jlliagre
    Mar 8, 2012 at 15:00

4 Answers 4


Thanks to @RelaXNow, here is the answer to the question:

VBoxManage modifyvm  "NameOfVM" --natnet1 "192.168/16" 
  • 2
    Which should be ran on the host machine, not the VM (it wasn't obvious to me from the start)
    – periklis
    Jan 30, 2014 at 11:50
  • After changing the DHCP settings, the DHCP server still offered leases in the old IP range to the guest. I had to restart the VirtualBox drivers to get the changes to take effect, using sudo vboxreload on the host (VirtualBox 5.1.26).
    – Rob W
    Aug 27, 2017 at 15:56

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.

enter image description here

  • Good answer thanks for the pic, I read the doc too, but I kept going to the specific machine settings not the "general" settings!
    – SSH This
    Jan 18, 2013 at 17:50
  • Recent versions have it File -> Preferences -> ... Mar 13, 2018 at 13:33
  • -1, OP's issue isn't the Host Network but the NAT.
    – mmlac
    Jan 23, 2019 at 11:59

Yes it can be changed. There is documentation on it here:


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"
  • Yes, but weird things can happen if your host doesn't know how to route to the VM. I had this problem with Vagrant taking 5 minutes to mount the shared folder. I could ping google from the VM, but I couldn't ping anything on the local net.
    – rox0r
    Oct 17, 2013 at 2:37
  • @rox0r I don't get what you mean. There is no routing involved from the host to the VM when NAT is used. From the outside, the VM is simply using the host address.
    – jlliagre
    Oct 17, 2013 at 4:11
  • 1
    Yeah, but the VM will not route back out the default gateway if it thinks the destination is on its subnet. Ie: if the VM is and you try to ping which is on the Host's subnet, it will not try to route through the NAT gateway. The same is true if you involve port-forwarding and the connecting machine is The packages will route to the VM but they'll never route back out.
    – rox0r
    Oct 17, 2013 at 22:03
  • Got it. Having the same subnet both internally and externally would be a very bogus configuration indeed.
    – jlliagre
    Oct 18, 2013 at 9:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.