virtualbox-commandline-networking-private-internal-network-host-NAT
//After the basics in creating your VM you may want to do something complex with the networking
//nic1 private internal network, VBOX auto creates a virtual switch when two VM's have the same network //the default is named "intnet" but you can have as many as you want with different names
vboxmanage modifyvm drupal -nic1 intnet
//THEN START your vbox... e.g. vboxsdl -vm drupal
ifconfig eth0 192.168.5.1 ifup eth0 //might be unnecessary
//2nd example: nic2 host interface (e.g. wifi w/ dhcp) //NOTE that hostifdev uses the (CASE SENSITIVE) description from "ipconfig /all" //the hostifdev# must match the nic# on the guest
vboxmanage modifyvm drupal -nic2 hostif -hostifdev2 "Dell Wireless 1390 WLAN Mini-Card"
THEN START your vbox... e.g. vboxsdl -vm drupal
//modify the file...
nano /etc/network/interfaces
auto eth1
iface eth1 inet dhcp
//the command enables eth1 and gets your ip address and watch the DHCPDISCOVER/OFFER/REQUEST/ACK
ifup eth1
//you may require /etc/init.d/networking restart or even a whole restart of the VM...
Virtualbox Host Interface Networking a device driver on your host system that alters data from your physical network adapter (a "net filter" driver). This allows VirtualBox to intercept data from the physical network and inject data into it, effectively creating a new network interface in software.
to setup PORT FORWARDING so that virtualbox listens and forwards packets "All TCP to port 2222 on the host will forward to port 22 on the guest."
VBoxManage setextradata "vmname" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/Protocol" TCP VBoxManage setextradata "vmname" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort" 22 VBoxManage setextradata "vmname" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort" 2222
// Intel PRO/1000, replace "pcnet" with "e1000", TCP or UDP are case insensitive // to replace a different interface instance change the /0/ // the name guestssh is arbitrary To remove a mapping, the same commands but leaving out the values (e.g. TCP, 22 and 2222)