Wednesday, June 20, 2012

how to use VirtualBox's "internal network" mode

Platform
  • VirtualBox 4.1.16 r78094
  • OS: Debian Linux
There is a situation when your Guest OSs need to access the Internet via NAT, for example, when you are using a dorm's Internet which they allow only 1 machine per account. And you also need your guest OSs to communicate with each other.
Let's say there are 2 Guest OSs which have to connect to the Internet via NAT. And you also need both of them to communicate with each other. This is impossible if you use just NAT one each virtual machine as they can't reach each other. You have to use VirtualBox's internal network.
This is the TRICKY part.

You must have 2 network interfaces on each virtual machine.

One is set to use NAT, another one is set to use "internal network" (choose "intnet1"). Then run this command:

VBoxManage dhcpserver add --netname intnet1
VBoxManage dhcpserver modify --netname intnet1 --ip 192.168.5.1 --netmask 255.255.255.0 --lowerip 192.168.5.2 --upperip 192.168.5.254 --enable

0 comments:

Post a Comment