Shutdown your VM and do:
VirtualBox > Settings > Network > Add (you will get vboxnet0
)
On a terminal ifconfig
will show you new interface vboxnet0
VM's Settings > System > check "Enable I/O APIC." VM's Settings > Network > Adapter 2 > host-only vboxnet0
Install OpenSSH Server
Edit /etc/network/interfaces
file to append the following lines:
auto eth1
iface eth1 inet static
address 192.168.56.10
netmask 255.255.255.0
Run sudo ifup eth1
from the Ubuntu command line.
SSH server should be up and running. Switch to your host terminal and enter ssh 192.168.56.10
sources:
For those who had issues configuring the interfaces, take in count, that is better to attach Adapter 1 as "host only adapter", and, same way, Adapter 2 as "NAT", so that, you won't have
route
problems. Normally, in production you setup the management interface in eth0, and left the others for other configurations. Virtualbox, support just 4 adapters, which is fine for testing.For Centos 6.x, ifcfg-eth1 (configured in adapter as attached to NAT).
I forked this one, and add some other info, that you might find useful tho. https://gist.github.com/crsuarez/5a066638a805e46b448acebd4f5fe8d1