This article will show you how to create a safe environment for Ethical Hacking.
VirtualBox software is our software of choice to create a virtual and safe environment for Ethical Hacking.
Let’s take a look at VirtualBox network settings to create a network of virtual machines. There are two main settings in VirtualBox network settings. These settings can be customized according to your requirements.

The two main settings are Adapter type and Attached.
VirtualBox Network Modes
VirtualBox offers a wide range of network modes. This is one of the best features of VirtualBox network settings. Each virtual network adapter can be configured separately to operate in a different mode. You can, for example, set the Host only mode and the NAT modes for adapter 1. The Attached drop-down menu allows you to select the network mode.

Not Attached: Virtual network adapters are installed in a VM, but the network connection is not there. This is similar to when you unplug an Ethernet cable using a physical adapter. This mode is useful for testing. This mode can be used to simulate unplugging a cable. The network connection will be available again after you switch to another network mode and disable the not attached mode. It is possible to check if a DHCP client has the correct IP address, whether the appropriate application can continue downloading after a link interruption, packet loss, etc.
You can choose to use the Not attached network mode instead. However, you must not tick the cable connected checkbox. The checkbox can be ticked/unticked when a VM has been started (see screenshot). To make changes to the VM network configuration, hit OK.
NAT: This network mode is the default for virtual machines. Users can easily access other networks without having to configure any additional settings. Virtualbox usually has the NAT engine and the DHCP server built-in. This setting allows virtual machines to get IP addresses from VirtualBox DHCP servers. The disadvantage of NAT mode is that Virtual machines (VM) will be invisible to the outside internet. You cannot run a server in this manner unless you enable port forwarding. This adapter, if set for multiple VM’s will isolate them from one another and prevent them from communicating with one another.

NAT Network: This mode is very similar to the NAT mode you use when configuring a router. Multiple virtual machines can communicate via the network if they are using the NAT Network mode. The VMs can access other hosts within the network as well as external networks, including the internet. External machines and hosts connected to the physical network cannot access VMs that are configured to use NAT network mode. This is similar to how you configure a router to provide internet access to your home network.
The NAT Network mode cannot be used to access the guest computer from the host machine unless port forwarding is configured in the global VirtualBox network settings. VirtualBox NAT router is built into the VirtualBox and uses a physical network controller of the VirtualBox host to act as an external network interface. This is also the case with the NAT mode.

In VirtualBox global settings, you can modify, delete, and create NAT Networks (click on the File menu and select preferences), go to network, and choose the add-network option.

Bridged Adapter: This mode connects the virtual network adapter for a VM to a network to which a VirtualBox host machine’s physical network adapter is connected. A VM virtual network adapter uses the host network interface to establish a network connection. Simply put, network packets are sent from/to the virtual adapter directly without any additional routing. VirtualBox uses a special net filter driver to create a bridged mode that filters data from the physical network adapter.
This network mode is used to run servers on VMs. It must be fully accessible via a local area network. Using the bridged mode, you can access a host computer, other hosts on the network, and external networks from VirtualBox. You can access the VM from the host machine and other hosts (and VMs) connected to the physical network.

VirtualBox network settings should be used to select the appropriate adapter if multiple physical network adapters are installed on your host machine. There are two physical network adapters: an Ethernet adapter and a WiFi adapter. You cannot use the low-level features of a WiFi adapter’s bridged mode in guest operating systems if you are using it for wireless network adapters. You cannot choose which WiFi networks you want to connect to or enable monitoring mode. Instead, you need to connect to the WiFi network on your host machine.

Virtualbox comes with additional features such as promiscuous mode. This mode of network operation allows a network adapter to receive and read every packet. In promiscuous mode, there are three options. Deny: Unintended traffic will be hidden from Virtual Machine that is connected to virtual network adapters. Allow Virtual Machines: All traffic that is not received from or sent by virtual network adapters will be hidden from Virtual Machines. All: This mode allows the network adapter to receive and read all traffic.
Internal Network: Virtual machines with adapters configured in the VirtualBox internal mode can be connected to an isolated virtual network. Virtual machines connected to the network can communicate with one another but cannot communicate with VirtualBox hosts or any other hosts in a network. Access to VMs that are connected to the internal network is not possible from a host computer or other devices. VirtualBox as an internal network that can be used to model real networks.

Host-only Adapter: This network mode is a mix of a bridged network and an internal network. This network mode allows virtual machines to communicate with one another and the host. The virtual machines can also communicate with the host machine. This mode is similar to the Internal network, where VMs cannot access machines in physical networks. Also, a Host-only adapter does not allow any device to be connected to a host-only network.

First, we must add a Host only adapter to the virtualbox. Click on File to add a Host Network Manager.

The Host Network Manager pop-up will appear. To add Host-only networks, click on create. Click on properties to edit network settings such as IP address, subnet mask, DHCP service, etc.

Conclusion.
Using VirtualBox and hacking VM’s that you have created and own is ideal for creating a safe hacking environment.
Use this table below as a snapshot to review the difference between the different VirtualBox network modes.

Hope you liked this article on How to Create a Safe Hacking Environment.
Are you interested in kickstarting your career in Cybersecurity no matter your educational background or experience? Click Here to find out how.