Virtual machines are programs that create an environment in which you can run other operating systems in isolated spaces, while still using your host operating system as the base. This means that you don’t have to reboot your computer when you want to switch between different environments.
Virtual machines usually have their network adapter settings set to NAT or other, for security reasons as if the network is compromised, it will affect the virtual machines as well. Additionally, an operating system with malicious code preinstalled can harm other devices on the same network. This is why VMs does not connect to the local network by default.
This guide shows how to connect to the local network with Oracle VM VirtualBox. If you wish your virtual machine to be connected to the internet for a variety of reasons, you can do so very easily in 2 steps.
Step 1: Go to VirtualBox settings
Launch your VirtualBox and click “Machine” and then “Settings”.
Step 2: Change the network mode
Navigate to the Network tab and make sure your network adapter is attached to “Bridged” instead of NAT or Host-only.

Do not forget to click “OK” to save.
You should now be connected to your local network, check your connection to make sure.