In the previous article Install & Create Virtual Machine, we explained how to install VirtualBox and create a Guest machine in it.
This article explains how to setup network for a guest machine and installing Guest Additions in a guest machine.
In Bridged Networking, all the packets are sent/received from the physical network adapter in the HOST machine. If someone attaches a packet sniffer tool in the HOST, then all the communication will be captured. In case of Internal Networking, the communication between the Guest machines will be secure.
So based on the need, we can actually choose between the networking modes. Now we will see how we can configure the ‘Networking’ in VirtualBox UI.
2) Select the ‘Guest Machine’ and click ‘Settings’.
3) Choose ‘Network’. It will have the details similar to
4) Check the ‘Enable Network Adapter’
5) Attached to, will have all the above mentioned mode. Choose the one you need. Here I choose ‘Bridged Adapter’This article explains how to setup network for a guest machine and installing Guest Additions in a guest machine.
Virtual Networking
Once a guest machine is installed, the first step that everyone like to do is to configure the network for that machine. VirtualBox provides a facility to add up-to 4 Network adapter (Ethernet card) to each guest machine through the GUI.Networking Modes
The following are the different types of networking modes available to be configured for each network adapter- Network Address Translation (NAT)
- Bridged Networking
- Internal networking
- Host-only networking
Network Address Translation
When a guest machine is set-up in this mode, then outside world will never be able to communicate with the Guest machine directly. When the guest machine send an IP packet to some remote machine, VirtualBox’s NAT Engine will receive the packet and extracts the TCP/IP segments, and change the IP address to the IP address of the HOST machine. So the outside world only see the IP address of the Host machine. When an reply is sent, then it will be received by the HOST machine and resend to the Guest Machine.Bridged Networking
It is similar to connecting a physical machine in a network. Outside world can directly communicate with the Guest machine. When a guest is configured for Bridged Networking, then VirtualBox uses a device driver on the host system, which can intercept and inject data through the physical network adapter present in the HOST machine.Internal networking
We can create more than one Guest machine, using VirtualBox. So if we want all the guest machine to communicate internally, then we can use this Internal Networking mode. Though we can use Bridged Networking also for this, Internal Networking is more secure.In Bridged Networking, all the packets are sent/received from the physical network adapter in the HOST machine. If someone attaches a packet sniffer tool in the HOST, then all the communication will be captured. In case of Internal Networking, the communication between the Guest machines will be secure.
Host-Only Networking
It is a hybrid of Bridged and Internal networking. In this mode, the Guest machine can talk to each other and also with the Host machine. It will look like, all machine ( including Host and Guest Machines ), are connected to a physical network switch. The guest machine cannot communicate with the outside world too, since they are not connected via a physical interface.So based on the need, we can actually choose between the networking modes. Now we will see how we can configure the ‘Networking’ in VirtualBox UI.
Steps to Configure Network
1) Launch ‘VirtualBox’2) Select the ‘Guest Machine’ and click ‘Settings’.
3) Choose ‘Network’. It will have the details similar to
4) Check the ‘Enable Network Adapter’
6) If your host network has more than 2 physical Ethernet card, then choose one among them, which will be used as the interface to send/receive packets by the Guest Machine
7) The advance menu, will have the Adapter type and MAC address for the virtual interface. Change it if you need.
8). Finally, you can ‘tick’ the Cable Connected check box. This is like physically connecting the network cable to a machine.
10) Now, configure the network as usual using ifconfig or ‘network-admin’ command and restart the networking services.
11) We are done with setting up a networking for a Guest machine successfully.
Guest Additions
Guest Additions can be installed in a Virtual Machine, after installing the Operating System in it. It consists of device drivers and other applications which can optimize the performance and usability of a Virtual Machine.The Guest Additions can provide the following features.,
- Mouse pointer integration
- Time synchronization
- Shared folders
- Seamless windows
- Shared clipboard
Guest Addition Installation
Here we will see how to install guest additions in Debian Lenny, and for all flavors mostly this will be applicable.By default under /usr/share/virtualbox/, there will be a file named, VBoxGuestAdditions.iso. We need to map this iso to the Guest machine. To do that,
1) Launch ‘VirtualBox’
2) Select the ‘Guest Machine’ & click ‘Settings’
3) Select ‘Storage’
4) On the ‘Storage Tree’, under ‘IDE Controller’, select the ‘Empty’ CD as shown in the following image
5) Now browse through the ‘/usr/share/virtualbox/’ directory, and choose the ‘VBoxGuestAdditions.iso’ file as shown below
6) Click ok
7) Start the Guest Machine
Once the Guest machine is started, you may notice some 2 mouse pointers. One for Host machine and One for Guest Machine. This often causes confusion, and we can avoid once we install the Guest Additions.
8). Login to the guest machine as ‘root’.
9) Mount the CD, with the help of ‘mount’ command.
# mount /dev/hdc /mnt # cd /mnt10) You will see a list of files as shown below
# ls -1 AUTORUN.INF VBoxWindowsAdditions.exe VBoxWindowsAdditions-x86.exe VBoxWindowsAdditions-amd64.exe autorun.sh VBoxLinuxAdditions.run VBoxSolarisAdditions.pkg 64Bit 32Bit11) Install the following dependencies
apt-get install make gcc linux-headers-$(uname -r)12) Execute
sh ./VBoxLinuxAdditions.run13) Once it is installed successfully, reboot the machine.
14) Now when the machine is staring, Guest addition service will start automatically. You will notice only 1 mouse pointer now, when the mouse pointer is within the Guest machine, it operates on the guest machine, once it is moved out of the Guest machine window, it operates on the host machine.
VirtualBox also sync the time between the host and guest machine. By default, for every 10 seconds, the guest time will be reset to the host time.
You can control various timing related parameters using ‘VBoxService’ command on the guest machine.
The following illustrates the time reset by VirtualBox.
Guest-Machine:~# date -s "Tue Mar 18 11:41:43 IST 2012" Sun Mar 18 11:41:43 IST 2012 Guest-Machine:~# date Sun Mar 18 11:41:48 IST 2012 Guest-Machine:~# date Sun Mar 18 11:41:53 IST 2012 Guest-Machine:~# date Sun Mar 18 11:47:48 IST 2012For more details with regard to Time Synchronization, please read Time Sync
Shared Clipboard
You can share the Clipboard ( A kind of buffer used for cut, copy, paste ), between the Guest machine and the host machine. It will work only if the Guest Additions is installed in the Guest machine. You can change the setting for clipboard sharing as shown in the figure.Once it is done, you can copy a document in the Guest machine, and paste the document in a file under the host machine and vice versa.
VBoxClient is the command under the Guest machine which can be used to start the VirtualBox X Window System guest services like clipboard, display, seamless windows. It will be started automatically (if guest additions are installed) when the Guest machine is booted.
No comments:
Post a Comment