This will show how to connect to your VirtualBox VM via network without changing your host computer's network settings like setting up a LAN or change your firewall configuration.
Therefore we will use a host-only-adapter as a virtual network visible only for the guest and the host.

In this example I am using one virtual network card using NAT, for the guest's internet access and a second card using host-only to interact with the host computer inside a secure, isolated network environment.
The guest system and the host are both Ubuntu 12.04 LTS instances.

Host Configuration

First, add a new "Host-only Network adapter" in your virtualbox UI: Follow File-<Preferences-<Network and make sure there is an adapter definition vboxnet0 with enabled DHCP. If not, create one.

You need to shut down the guest machine before you are allowed to change its settings.
Then go to your machine item and enable a second network Adapter with "Host-only" mode.
That's it for the host side.

Guest Configuration

Important config files
  • /etc/network/interfaces

After starting the machine, we need to configure the guest's network to use the new network adapter. Edit the /etc/network/interfaces
Add/edit the eth1 entry:

auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
auto eth1
iface eth1 inet dhcp

Then restart the network service:

root@guestbox # /etc/init.d/networking restart
and check if eth1 is listed at your ifconfig output:
root@guestbox # ifconfig
Okay, done with the guest configuration.

Start play around

The IP address listed at ifconfig at eth1 on the guest is now reachable on the host machine and the IP of the host is listed at the vboxnet0 adapter in the hosts ifconfig output, if you want to connect from the guest to the host.

                         # IP of guests eth1 ifconfig
andre@buenosaires ~ % ssh tester @ 
tester @'s password: 
Welcome to Ubuntu 12.04 LTS
                         # IP of hosts vboxnet0 ifconfig
tester@guestbox $ ssh andre @  
Welcome to Ubuntu 12.04 LTS

For maximum comfort, you can name the IP address in your /etc/hosts:

andre@buenosaires ~ % cat /etc/hosts       buenosaires     localhost.localdomain   localhost  vbox-worker-1
andre@buenosaires ~ % ssh tester @vbox-worker-1
tester @'s password: 
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic-pae i686)

How to enable internal networking

Make sure both machines have a network card attached to the same internal network.
Then issue the following command to enable DHCP for this internal net. (On the host machine, of course)

andre@nairobi ~ % VBoxManage dhcpserver add \
    --netname intnet --ip --netmask \
    --lowerip --upperip --enable

If the machines were running during the management command, the need to be restarted. (in my case).
Now, on the guest machines you should find your ethernet device with the obtained IP address.

root@testkraxn /home/tester # ifconfig | grep -C1 13.13
eth8      Link encap:Ethernet  HWaddr 08:00:27:c8:09:0e  
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::a00:27ff:fec8:90e/64 Scope:Link