I have recently switched from Ubuntu to Win8 as my basic system. As RoR development under Win is a suicidal practice, I have decided to install Ubuntu on virtual machine (Oracle VM Box).
I want the guest Ubuntu network services (in particlar, LAMP&Rails server services) to be visible for host + guest OS should have access to the internet. Luckily, VirtualBox provides an easy method to accomplish this target in a few steps using secondary host-only network interface.
- Install guest OS using default NAT network interface.
- Keeping the VM turned off, configure according to your preferences the host-only network interface in VirtualBox (File->Preferences->Network in VirtualBox main window). Then add the host-only adapter as a secondary network interface for guest OS.
- Configure guest OS to use static IP on secondary network interface.
- Edit hosts file in host OS. In case of Windows 8, open notepad as administrator and edit %systemroot%\system32\drivers\etc\hosts appending the following line (GUEST_IP MOCK.DOMAIN) as in the example below:
192.168.52.101 greg.or
Now you can easily access the guest network services (WWW, SSH, FTP etc.) from your host OS. You can find a comprehensive description of the host-only network layer provided by VirtualBox on slides published by Alex Hahn.
Wrzesień 28th, 2012
Tags: virtualbox