VirtualBox Network and Skills

VirtualBox Network and Skills

2018-04-14. Category & Tags: Default VirtualBox, Network

OBS: cloning a VM with the status of pause (not powered-off), it canNOT re-initialize the MAC address. Thus, it is necessary to disconnect the cable and poweroff to re-initialize the MAC and then boot.


Tested on v18.04.

sudo apt-get update && \
sudo apt-get -y install virtualbox

(sometimes, maybe need to prepare the env before installation:)

sudo apt-get update && \
sudo apt-get -y install gcc make linux-headers-$(uname -r) dkms && \
wget -q -O- | sudo apt-key add -  && \
wget -q -O- | sudo apt-key add -  && \
sudo sh -c 'echo "deb $(lsb_release -sc) contrib" >> /etc/apt/sources.list'

NICs #

Two NICs are needed BEFORE installing the system to avoid messy issues.

  • To let the guests talk with each other, they need to have the same network, usually one of the “NAT network“s.
  • To access the guests from the host, the guests need another “Host-only” link.

Nat-Network #

To create a “NAT network”:

VBoxManage natnetwork add --netname natnet1 --network "" --enable --dhcp on
VBoxManage natnetwork start --netname natnet1

(There is no NAT netwoks by default which is totally not understandable.)

Tip: dhcp can be turned off later:

VBoxManage natnetwork modify --netname natnet1 --dhcp off

Tip: port-forwarding:

VBoxManage natnetwork modify --netname natnet1 --port-forward-4 "ssh:tcp:[]:1022:[]:22"



Note: a name-server (e.g. Bind) is needed before installing a DHCP server.
The VB DHCP servers are not working properly and hard to manage. It is suggested to setup a seprate DHCP server. See here.