VirtualBox host only adapter interface doesn't get an IP address in Oracle Linux 8

Each configured with the same Hhost only adapter DHCP server.

DHCP server settings #1

DHCP server settings #1:

DHCP server settings #2

DHCP server settings #2:

enp0s8 interface (host only adapter)

What am I missing here? Why does interface enp0s8 has no IP addres and why doesn’t the manual IP assignment work?

55.9k 23 23 gold badges 168 168 silver badges 215 215 bronze badges asked May 17, 2022 at 18:31 Arik Jordan Graham Arik Jordan Graham 161 1 1 gold badge 1 1 silver badge 2 2 bronze badges

I think this is an old bug in VirtualBox. Try to exchange the adapters, so Adapter 1 is the Host Only.

Commented May 17, 2022 at 19:36

@harrymc , Well I tried to do so , But then I didn't had an IP address for my Adapter 2 , which is the NAT interface , so I didn't had internet connectivity. Very strange. Thanks

Commented May 18, 2022 at 20:05

If the DHCP of the host-only network isn't working, static IPs might be the solution. Try perhaps to reinstall VB, hopping you're using the latest version.

Commented May 18, 2022 at 20:31

3 Answers 3

Simply, request a new IP from DHCP server:

sudo dhclient -1 enp0s8 
answered Mar 24, 2023 at 4:02 Abhinav Kumar Abhinav Kumar 31 4 4 bronze badges

There's been ongoing discussion on the answer posted by John. But I didn't find those answers/discussions working towards a plausible resolution. May be I missed something? But surely I read tons of articles/posts by now.

So here's my answer which should resolve the issue of the main question relating to assigning IP address while using Host Only Network Adapter.

Context

When I spin-up a virtual machine with a Host Only Network Adapter by default, the VM doesn't get an IP on an interface called enp0s8 . This interface is valid for Debian 10. But, I am able to see an IP is assigned to enp0s3 interface. Yes, all the preceding comments are correct mentioning IP does not get assigned! However, the idea of assigning a VM to a Host Only Adapter is to be able to communicate to this new VM from host machine. And since, there's no IP assigned to this VM, host machine simply will not be able to connect to it.

Resolution

For Debian/Ubuntu OS, you need to edit this file /etc/network/interface .

Then update the file with below contents. Note, there are 4 spaces for address and netmask directives.

auto enp0s8 allow-hotplug enp0s8 iface enp0s8 inet static address 192.168.56.11 netmask 255.255.255.0 

Please note, I set up static instead of dhcp . This we should be able to assign a static IP to a particular VM. Now, perform restart on the VM.

Test

Do a ping test from host machine with VM static IP: 192.168.56.11 . You should be able to ping success result. As such, you should be able to connect to this VM using SSH login as well i.e., ssh [email protected] . Use the username and password of your VM OS.

Hope this helps someone!

55.9k 23 23 gold badges 168 168 silver badges 215 215 bronze badges answered Sep 1, 2022 at 0:17 136 5 5 bronze badges thanks a lot. After a few hours of trying, this is what worked for me Commented Dec 9, 2022 at 11:29

Virtualbox host only adapter interface doesn't get an IP

That is entirely normal.

A Host Only Adapter is isolated and does not include Internet. The Host Only machine should be able to communicate with the Physical Host Machine, and then would have an IP on the Host Machine.

Change the Host Only Adapter to NAT if you wish it to have Internet Access.

To avoid confusion, here is a decent article on connecting a Host Only VM to a Host machine

Create the Virtual Network First, you must set up a virtual network that the host-only adapter(s) will communicate through.

In the VirtualBox window, click File > Host Network Manager > Create. Check Enable under the DHCP Server column of the network you just created. Select your network and click Properties. In the Adapter Tab, select Configure Adapter Manually and use the following settings: IPv4 Address: 192.168.56.1 IPv4 Network Mask: 255.255.255.0

In the DHCP Server Tab, make sure that Enable Server box is checked, and use the following settings: Server Address: 192.168.56.100 Server Mask: 255.255.255.0 Lower Address Bound: 192.168.56.3 Upper Address Bound: 192.168.56.254

Click Apply and then Close Add a Host-Only Adapter to the Guest Machine For each guest you want to communicate with using the network from the previous step, you need to add a host-only adapter.

Select the appropriate guest machine Click Settings > Network Under the Adapter 2 tab, input the following settings: Enable Network Adapter: Checked Attached to: Host-Only Adapter Name: vboxnet0 (NOTE: this should be the name of the network you created in the previous steps)

Click OK