1

My Host Machine's OS is Windows and I am using Oracle Virtual box. I have 3 virtual machines: Kali Linux, Metasploitable and Windows 10.

Problem 1 : I have a site hosted in Metasploitable. If I use NAT Network then I am able to access that site using the IP in Kali Linux and Windows 10.

Now I want to access the site hosted in VM from host machine as well.

Long story short, I want to create a network so that I can access host machine from VM and vice versa.

Problem 2 : I also want to share the internet of host machine (LAN and WIFI) with my VMs

1
  • 1
    There are several questions here on SU dealing with more or less exactly this. If you go through the links in the "Related" section to the right you'll find these. Start with this one: superuser.com/questions/366207/… And let us know if it answers your question or not. Commented May 8, 2018 at 17:19

1 Answer 1

1

You need to set the VMs to have a "bridged" network. This will give each VM a unique IP that any computer on your network can connect to.

Below is the link to the virtual box manual concerning this and an exert from the article talking about bridged networks.

https://www.virtualbox.org/manual/ch06.html

With bridged networking, VirtualBox uses a device driver on your host system that filters data from your physical network adapter. This driver is therefore called a "net filter" driver. This allows VirtualBox to intercept data from the physical network and inject data into it, effectively creating a new network interface in software. When a guest is using such a new software interface, it looks to the host system as though the guest were physically connected to the interface using a network cable: the host can send data to the guest through that interface and receive data from it. This means that you can set up routing or bridging between the guest and the rest of your network.

For this to work, VirtualBox needs a device driver on your host system. The way bridged networking works has been completely rewritten with VirtualBox 2.0 and 2.1, depending on the host operating system. From the user perspective, the main difference is that complex configuration is no longer necessary on any of the supported host operating systems.[31]

Note Even though TAP is no longer necessary on Linux with bridged networking, you can still use TAP interfaces for certain advanced setups, since you can connect a VM to any host interface -- which could also be a TAP interface.

To enable bridged networking, all you need to do is to open the Settings dialog of a virtual machine, go to the "Network" page and select "Bridged network" in the drop down list for the "Attached to" field. Finally, select desired host interface from the list at the bottom of the page, which contains the physical network interfaces of your systems. On a typical MacBook, for example, this will allow you to select between "en1: AirPort" (which is the wireless interface) and "en0: Ethernet", which represents the interface with a network cable.

Note Bridging to a wireless interface is done differently from bridging to a wired interface, because most wireless adapters do not support promiscuous mode. All traffic has to use the MAC address of the host's wireless adapter, and therefore VirtualBox needs to replace the source MAC address in the Ethernet header of an outgoing packet to make sure the reply will be sent to the host interface. When VirtualBox sees an incoming packet with a destination IP address that belongs to one of the virtual machine adapters it replaces the destination MAC address in the Ethernet header with the VM adapter's MAC address and passes it on. VirtualBox examines ARP and DHCP packets in order to learn the IP addresses of virtual machines.

Depending on your host operating system, the following limitations should be kept in mind:

On Macintosh hosts, functionality is limited when using AirPort (the Mac's wireless networking) for bridged networking. Currently, VirtualBox supports only IPv4 and IPv6 over AirPort. For other protocols (such as IPX), you must choose a wired interface.

On Linux hosts, functionality is limited when using wireless interfaces for bridged networking. Currently, VirtualBox supports only IPv4 and IPv6 over wireless. For other protocols (such as IPX), you must choose a wired interface.

Also, setting the MTU to less than 1500 bytes on wired interfaces provided by the sky2 driver on the Marvell Yukon II EC Ultra Ethernet NIC is known to cause packet losses under certain conditions.

Some adapters strip VLAN tags in hardware. This does not allow to use VLAN trunking between VM and the external network with pre-2.6.27 Linux kernels nor with host operating systems other than Linux.

On Solaris hosts, there is no support for using wireless interfaces. Filtering guest traffic using IPFilter is also not completely supported due to technical restrictions of the Solaris networking subsystem. These issues would be addressed in a future release of Solaris 11.

Starting with VirtualBox 4.1, on Solaris 11 hosts (build 159 and above), it is possible to use Solaris' Crossbow Virtual Network Interfaces (VNICs) directly with VirtualBox without any additional configuration other than each VNIC must be exclusive for every guest network interface.

Starting with VirtualBox 2.0.4 and up to VirtualBox 4.0, VNICs can be used but with the following caveats:

A VNIC cannot be shared between multiple guest network interfaces, i.e. each guest network interface must have its own, exclusive VNIC.

The VNIC and the guest network interface that uses the VNIC must be assigned identical MAC addresses.

When using VLAN interfaces with VirtualBox, they must be named according to the PPA-hack naming scheme (e.g. "e1000g513001"), as otherwise the guest may receive packets in an unexpected format.

Using a bridged network will make the VMs appear as physical computers to your network equipment which will fix both problems. Depending on your setup you might have to change some settings for links to the hosted site as it will most likely get a new IP.

EDIT 1:

Its very possible that kali linux is not liking the drivers virtual box is using or kali does not have drivers compatible with the bridged adapter.

2
  • Using Brided network and WiFi connection enables me to access the site on Metasploitable VM from Host Machine and Windows 10 VM. However, the internet is not available on Kali Linux VM. How can I fix this? Commented May 9, 2018 at 7:14
  • Well, I just tried Bridged Network again and this time it worked. I don't know the reason but what I did was start all my VMs with Bridged Network and then I turned off my wifi connection in Host machine and started it again after a while. BINGO!!! I was able to get what I was looking after. :) Thanks people Commented May 11, 2018 at 12:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .