VirtualBox Network and Skills
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.
INSTALL ON UBUNTU
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 https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add - && \ wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add - && \ sudo sh -c 'echo "deb http://download.virtualbox.org/virtualbox/debian $(lsb_release -sc) contrib" >> /etc/apt/sources.list'
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.
To create a "NAT network":
VBoxManage natnetwork add --netname natnet1 --network "192.168.15.0/24" --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
VBoxManage natnetwork modify --netname natnet1 --port-forward-4 "ssh:tcp::1022:[192.168.15.5]: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.