As stated in the VirtualBox user manual, section 9.10.1 Configuring the address of a NAT network interface
In NAT mode, the guest network interface is assigned to the IPv4 range 10.0.x.0/24 by default where x corresponds to the instance of the NAT interface +2. So x is 2 when there is only one NAT instance active. In that case the guest is assigned to the address 10.0.2.15, the gateway is set to 10.0.2.2 and the name server can be found at 10.0.2.3.
This means that for Ubuntu, the /etc/network/interfaces
entry for the network card settings are something as below:
iface <interface> inet static address <static IP> (e.g. 10.0.2.7) netmask 255.255.255.0 network 10.0.2.0 broadcast 10.0.2.255 gateway 10.0.2.2
Also, add the following nameserver entry to /etc/resolv.conf
nameserver 10.0.2.3