Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

migrated from Mar 8 '12 at 15:46

This question came from our site for system and network administrators.

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" – RelaXNow Mar 8 '12 at 13:43
Then post that as the answer, and you can accept it – cutrightjm Mar 8 '12 at 13:44
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 :). – RelaXNow Mar 8 '12 at 13:46
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. – Bart Silverstrim Mar 8 '12 at 14:14
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 '12 at 15:00
up vote 17 down vote accepted

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

VBoxManage modifyvm  "NameOfVM" --natnet1 "192.168/16" 
share|improve this answer
Which should be ran on the host machine, not the VM (it wasn't obvious to me from the start) – periklis Jan 30 '14 at 11:50

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

share|improve this answer
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 '13 at 17:50

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

It's handled through the VBoxManage dhcpserver command.

share|improve this answer

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"
share|improve this answer
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 '13 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 '13 at 4:11
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 '13 at 22:03
Got it. Having the same subnet both internally and externally would be a very bogus configuration indeed. – jlliagre Oct 18 '13 at 9:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .