Manual network settings not working in vitualbox

I first installed Rocky in virtualbox and used dhcp. The machines was abled to get online and pull updates and browse the web.

I next installed Rocky in virtualbox and manually set the network with settings that match what I have on my CentOS box (not in virtualbox). I cannot get the virtual machine online. My network settings are correct since they match my functional CentOS box. I am using a different static ipV4 address then that of the CentOS box.

Any insights on the issue? I’ve struggled with this all day.

Hi,

In the network settings, have you changed “Attached Adaptor” to “Bridged Adapter”?

Thanks Tom.

1 Like

First, CentOS has libvirt/KVM in its repositories. It is thus easy to make a host hypervisor without third-party software, like virtualbox. (Downside, I’ve had no need to learn any other hypervisor than the libvirt/KVM.)

Libvirt does by default create a “default network”. A virtual, separate subnet with distict address range. It does provide DHCP and DNS for all the VM’s are are attached to it and makes the host route between the virtual subnet and the physical subnet that the host is connected to. With masquerade (so host acts like any home router; hides that “behind it” are more machines).

If VM is connected “bridged”, then the host acts as a network switch; the VM is in same broadcast domain/subnet as host and the machines outside of the host. Preferably that subnet has its own DHCP server, set to configure clients, like the host and any VM’s bridged in it.

Additionally, routed traffic is filtered by the host (although firewalld can’t really filter forwarded traffic – not yet), but bridged traffic is not filtered by the host (although that can be enabled).

If the virtualbox has similar, has “routed, with sNAT” as default setup, then it probably offered DHCP for the first machine and if you can still check, you will find what kind of subnet the first Rocky did get.

As @tjdoyle said, getting the VM into same subnet as “outside” does require “bridging”. (Bridge is a switch. Switch is a bridge.)

When I set up VM host for bridging, I create the bridge in the host before virtualization is installed. The bridge is the connection/interface, where the host has IP address. The bridge is started by (NetworkManager.service) at boot. The libvirtd then launches VMs and attaches them to the bridge. (In reality my hosts have N bridges in N VLANs and the host does not have IP address on all subnets.)

2 Likes

Thanks for the replies. @tjdoyle setting network to Bridge in VB settings solved the getting online problem, and I can SSH to the VB Rocky from my PC and laptop.

2 Likes