Creating Safe Hacking Environment
May 02, 2021
This blog article will help you in setting up a safe virtual environment for practicing ethical hacking skills. We can create a virtual environment with the help of VirtualBox software. Let’s have a look at virtualbox network settings to establish a network of virtual machines. In virtualbox network settings there are two major settings that one should know about, to configure based on their requirement. As shown in the below image Adapter Type and Attached to are the two main things.
Adapter Type - Hardware that will be virtualized
Mode of Network (Attached to) - The virtualization mode that the virtual machine will operate with respect to physical networking on the host.
Virtual Network modes
Virtualbox has different network modes, the interesting thing is we can use different adapters with different network modes. For example one can use a virtual machine by setting adapter1 to NAT mode and adapter2 to Bridged adapter mode and adapter3 to Host-only adapter, he can work in different networks with different interfaces.
- Not attached : Users can make the VM isolated from the network and internet by configuring this network mode. This is just like turning off wifi and disconnecting ethernet cable.
- NAT : This is the default network mode for virtual machines, users can access external networks easily without configuring any extra settings with this network mode. Virtualbox generally has the built-in DHCP server and the NAT engine. In this setting a virtual machine takes IP addresses from a virtualbox DHCP server. The NAT mode possess the disadvantage such as, similar to the private network which is behind the router, VM (virtual machine) will remain unseeable as well as distant from outside internet. Unless you set up the port forwarding, you cannot be able to run a server this way. If you set this adapter for multiple VM’s they are completely isolated from one another and they can not communicate with each other.
- NAT Network : This mode will be same as NAT mode we use for the router configuration. If you configure multi VM’s with this NAT Network mode this adapter will group all those VM’s and assign different IP’s to them. They can easily communicate with one another and can access external networks and the internet. Any of the machine from host machine connected physical network or the external networks will be unable to connect to Virtual Machines which are set to the NAT Network. Physical network interface controller related to VirtualBox host is used by the built-in VirtualBox NAT router as the external network interface.
You can create,delete and modify NAT Network in virtualbox global settings (click on File menu, select preferences, go to network and select add nat network ).
- Bridged Adapter : This network adapter mode will be helpful for connecting a virtual network adapter to the network to which the host physical network adapter is connected. In this scenario host network interface is used by the network adapter to persuade the network connection. With this the virtual machine is directly available to all the machines that are present in the physical network. After selecting the bridged adapter you can see different interfaces available on the host machine, you have to select the interface ( ethernet or wi-fi ) through which you are getting internet or on which network you want your VM should present.
Here network mode VM's will able to access machines in the physical network and vice versa. To filter the information of the physical network adapter of a host machine the VirtualBox will use a net filter driver for bridged adapter.
Virtualbox also comes with some extra features like promiscuous mode. It is a mode of network operation in which a network adapter can receive and read each and every packet. There are three options available in promiscuous mode.
Deny : Unintended traffic will remain hidden from Virtual Machine which is related to the virtual network adapters.
Allow VMs : Entire traffic which isn't received to or that is sent from virtual network adapters will remain concealed from the Virtual Machine’s.
Allow all : In this mode network adapter can receive and read all the traffic.
- Internal Network : In this mode the virtualbox creates a completely isolated virtual network. The virtual machines under this network will get IP addresses from this network gateway. In internal network mode virtual machines in this network can communicate with each other and can not communicate with host machine and host machine or any machine in the physical network also can not access machines in this internal network. We can use this network mode for creating any testing environment isolated from the physical network.
- Host-only Adapter : This mode of network is a hybrid network of Bridged network and Internal network. In this network mode virtual machines can communicate with each other and the host also. The host machine also can communicate with the virtual machines. In this mode the virtual machines. In this mode like in Internal network VM cannot access machines in physical network and vice-versa. Any device cannot be connected outside host-only network as Host-only adapter will not allow.
To use a Host-only adapter first we need to add one in the virtualbox. To add Host-only network open virtualbox click on File and select Host Network Manager.
Host Network manager pop-up will open, to add Host-only network click on create. Select created network and click on properties to manage network settings like IP address, subnet mask and DHCP service etc.
Difference in Network modes:
References:
https://www.virtualbox.org/manual/ch06.html
https://www.nakivo.com/blog/virtualbox-network-setting-guide/
https://www.lucidchart.com/ : Network diagrams creating platform