Bitnami Stacks are a convenient way to get quick VMs to test out some piece of code or another and with Virtualbox, it works out great as you get a free quick pre-installed stack to develop / test your application. Â Recently I downloaded a few of these to help me out in my classes and development
Great thing about these stacks is that with pre-configured VMs, you can quickly test a certain app out there that you are thinking of using and play with it a bit.
Getting these stacks on the network is an issue. Â After importing them in virtualbox (using version 4.3.8 at the moment) and running the stacks, I realized getting them to communicate with Windows 7 host so that I could access the application being tested was going to be a little bit of a problem as I’m sitting at work, behind a proxy. Â At home it worked absolutely great, a bridged ethernet adapter with a quick and easy setup, picked up a DHCP address from my host’s wireless adapter and both guest and host OS communicated fine. Â Problem at work was that there’s a proxy, and to get an IP for a device, you had to open the browser and login with your employee credentials. Â These stacks are all command-line Ubuntu 12.04 VMs.
So how do I communicate with my app?
Solution: Setup two adapters on the VM: One on NAT to allow the VM to connect to the net, and the other in “host-onlyave access to the application running on my stack.
You can have a look at the host-only network setup on your virtualbox. Â Go to File > Preferences > Network and you will see it.
Click on the little tool icon on the right side and you can see the settings of this ethernet adapter in the Virtualbox preference settings.
Simply ensure that DHCP server is enabled, this way, you won’t have to setup the network interface manually once you start up your virtual machine.
Now, once this is good, in the network settings of your virtual machine that you are looking to modify, setup two adapters:
Right click on the name of your VM, select Settings and then click on “Network”. Â You will see four tabs for four adapters. Â Modify the adapter number 1 to NAT as in the image below: And then select “Adapter 2” from the Network tabs, click on the checkbox “Enable Network Adapter”, change the “Attached to” setting to “Host-only Adapter” and make sure the name of the adapter matches the one we noticed earlier when we checked out the virtualbox preferences.
Now start up your VM and let’s configure it.
Again, my VM (the bitnami stack VM) is on Ubuntu 12.04, once you are logged in, have a look at what adapters you have. Â There are several commands that will let you see them:
$ ip link show $ ls /sys/class/net $ /sbin/ifconfig -a $ netstat -i
All of these commands will show you the network interfaces on your VM. Â For example on my particular VM, these commands showed that I had three interfaces, the “lo”, “eth1” and “eth2”. Â The “lo” interface is the loopback, “eth1” was on NAT and “eth2” was the host-only adapter. Â Now let’s set these up. Â Using your favorite text editor (vi, etc.) edit the /etc/network/interfaces file and set it up
sudoedit /etc/network/interfaces # The loopback network interface auto lo iface lo inet loopback # the primary network interface set on NAT auto eth1 iface eth0 inet dhcp # the other network interface set on Host only auto eth2 iface eth1 inet dhcp
sudo /etc/init.d/networking restart
Now once this is ready, let’s restart networking using the command above.
if you do ifconfig again, you will see that your eth2 interface will have an address such as 192.168.56.101 Â (in my case, I ended up with DHCP giving this particular VM 192.168.56.102 IP)
Point your browser to this IP (if that’s what you are trying to setup) and voila, you can now talk to your VM.
Source:Â http://askubuntu.com/questions/293816/in-virtualbox-how-do-i-set-up-host-only-virtual-machines-that-can-access-the-in
One response to “Bitnami + Virtualbox – Host Only Network”
nerrrd