As we know, VirtualBox provides several adapters that we can add and be used by OS guest. At the time of writing this post, I have an OS X (host) and Ubuntu Server 16.04.1 LTS (guest). The needs are, I want to be able to remote my Ubuntu from OS X terminal. I also want my Ubuntu guest can connect to internet. I have configured two network adapters for the guest (NAT and host-only).
When I run
$ ifconfig
The first/default adapter (NAT) enp0s3
is recognized without any problems by the guest. But not the second one (host-only). To make the second adapter visible, I have to run a command
$ sudo dhclient
$ ifconfig
Now I got both adapters enp0s3
(NAT) and enp0s8
(host-only) visible on terminal. And now I can ping and run ssh from host (OS X) to guest (Ubuntu server).
In order to make it permanent, we need to edit /etc/network/interfaces
with the following lines
# The second network interface
auto enp0s8
iface enp0s8 inet dhcp
Then restart the network service by running
$ sudo /etc/init.d/networking restart
That’s my note for now and thanks for reading.