2009-12-10

VirtualBox how-to access guest (ip, webserver)

I needed to do some iPhone development and the SDK requires Snow Leopard. So I installed it:
Carbon Clone Copier to make a mirror of my internal HD to an external USB Drive.
Remove USB Drive.
Wipe the internal HD.
Install Snow Leopard.
Attach the USB Drive, import settings from it.

Most things went well, however VmWare Fusion 2 did not start. Rather than mess with Fusion, I decided to give VirtualBox a go.
I copied the .vmdk file (inside the virtual machine folder), and imported it to VirtualBox. No problems.
Uninstalled vmware tools, installed VirtualBox tools. Very smooth so far. But I want to develop webpages on Linux in the guest, then access them from the Mac host. And I could not reach the guest from the host.

Here is how I fixed it partially (so far):

Info from virtualbox forum

Add two network cards (first host-only, second NAT) using VirtualBox gui (when guest is turned off).
reboot.
run dhclient as root (on Ubuntu sudo dhclient)

Now the host only gets ip address, see what dhclient outputs as inet for the eth (I also have eth2 (NAT) and eth0 (loopback). Mine was 192.168.56.3

In order to get a stable adress all the time, I want to configure a static ip for my vm. I choose 192.168.56.56 because it is a nice number (and I guess the the dhcp server in Virtualbox will not use it).

Now I edit /etc/network/interfaces

#This is a host-only static interface for VirtualBox
iface eth1 inet static
address 192.168.56.56
netmask 255.255.255.0

reboot.
This does not work. I still have to do sudo dhclient and I get ip 192.168.56.3
Anway, I can live with a dynamic address for a while. And I need to get some work done.

However I found a good link to read when I want to fix this sometime in the future.
Ubntugeek, I think the solution is in here somwhere

No comments:

Post a Comment