Pages

Friday, July 1, 2016

Networking in Virtual box !!!


Once virtual machine been setup, there is obvious requirement to connect to that particular Virtual machine via putty, winscp and access deployed application via browsers. Although, the default network configuration(NAT) does not allow you to do it. 

At very high level, below are the minimum requirement a user must be looking for in terms of connectivity to that particular Virtual machine. 

Virtual Machine Connectivity Requirement-

  • Guest (VM) machine should be accessible to Host (Local Laptop/Desktop) Machine for multiple purpose e.g. ssh access and http access etc. using putty, winscp and browsers.  
  • If you have group of Guest machines e.g. Guest1 and Guest 2, both should be communicating to each other. 
  • Guest machine should also have internet connectivity to install various OS packages etc.

Various Networking Option available in Virtual Box.

Virtual box has given various different network adapter types to achieve various Networking requirement. However, it’s bit TDS job to achieve all of the above listed requirement using single adapter type. At least I struggle a bit to achieve the same, it might be due to the fact that, I am not a Network Expert person but since I worked out how to achieve this, I thought it’s good idea to share this info as many of us need similar setup.



Virtual Box Adapters Types -

Not attached -  In this mode, VirtualBox reports to the guest that a network card is present, but that there is no connection – as if no Ethernet cable was plugged into the card. This way it is possible to “pull” the virtual Ethernet cable and disrupt the connection, which can be useful to inform a guest operating system that no network connection is available and enforce a reconfiguration.

Network Address Translation (NAT) - If all you want is to browse the Web, download files and view e-mail inside the guest, then this default mode should be sufficient for you.

NAT Network - The NAT network is a new NAT flavour introduced in VirtualBox 4.3.

Bridged networking - This is for more advanced networking needs such as network simulations and running servers in a guest. When enabled, VirtualBox connects to one of your installed network cards and exchanges network packets directly, circumventing your host operating system’s network stack.

Internal networking This can be used to create a different kind of software-based network which is visible to selected virtual machines, but not to applications running on the host or to the outside world.

Host-only networking This can be used to create a network containing the host and a set of virtual machines, without the need for the host’s physical network interface. Instead, a Virtual network interface (similar to a loopback interface) is created on the host, providing connectivity among virtual machines and the host.