Virtualbox Localhost Mac



Localhost

Functionality is limited when using AirPort, the Mac's wireless networking system, for bridged networking. Currently, Oracle VM VirtualBox supports only IPv4 and IPv6 over AirPort. For other protocols, such as IPX, you must choose a wired interface. On Mac OS (host): Shutdown your VM and do: VirtualBox Settings Network Add (you will get vboxnet0) On a terminal ifconfig will show you new interface vboxnet0. VM's Settings System check 'Enable I/O APIC.' VM's Settings Network Adapter 2 host-only vboxnet0. On Ubuntu (guest): Install OpenSSH Server. The VirtualBox graphical user interface supports only four network adapters for each VM. This limits the complexity of network scenarios you can create. Fortunately, VirtualBox really supports up to thirty-six network adapters per VM. These additional network adapters may be configured using the VirtualBox command-line interface, which is a.

Heads Up! This post is now very outdated. There’s a MUCH easier way to access localhost in VirtualBox.

Last week I explained how to convert the IE6 – IE8 VirtualPC disk images to VirtualBox on the Mac. This week I noticed something critically wrong, I can’t access localhost or any LAN IP address from inside VirtualBox. This is a huge problem if you want to do local testing in IE.

The problem is that Mac support is still rather early with VirtualBox and they only provide a NAT networking option. I wont explain what NAT is because I don’t completely understand it myself. If you’re on Linux or Windows you can simply use the bridged network and it’ll work fine.

As with any problem, there is a solution! You could go buy VMWare Fusion, which should support this out of the box, but what’s the fun and challenge in that? The fun and free solution is to use a service called DynDNS.

What is DynDNS

If you’re like most people your ISP gives you a dynamic IP, which means that your home network doesn’t always have the same IP address and every so often your ISP will assign you a different one. DynDNS will give you a free domain name that always points to your ever changing home network IP address.

This means that when you’re done you’ll load a URL like “http://<you>.dyndns.org/” instead of “localhost” inside VirtualBox. This also assumes that you have some sort of web server running on your computer to serve up the pages.

Step 1 – Web Server

Mac

Setup a simple web server like Apache or the free version of LightSpeed (free version is at the bottom of the download page).

Make sure the server is installed and running properly before proceeding.

Step 2 – DynDNS Account

Go to DynDNS, register an account and create a new host. The site has good help sections to assist you through any issues or questions you run into. (see the DynDNS How-To section)

After creating the new host, download, install and run the DNS update program. This will update the service with your new IP address every time it changes.

Step 3 – Router

If your network uses a router, you might need to update it’s settings to let the requests through to your computer inside the network. At this point it is important to realize that your router has the “main” IP, which is provided by your ISP, and each computer inside your network will get their own “internal” IP address, provided by the router itself.

First test the new DynDNS URL you created. When you load the URL in your browser does it show pages from your local web server or does the browser sit there and mock you as it endlessly spins the “loading” animation?

If your web server didn’t load anything, you might need to alter your firewall settings and/or setup port forwarding in your router. Start by checking your router manual for information on how to login and change settings on it. On my SMC wireless router after logging in I found the settings I needed under Advanced Setup > NAT > Virtual Server. There I entered the last number from my “internal” IP address (IP on my computer) and the port that should direct to that computer. So if my internal IP is 192.160.2.53 and my web server is setup to respond to port 80, I enter “53” and “80” into the fields.

Step 4 – Static Internal IP

If you had to setup port forwarding in the last step, you should also create a static internal IP on your computer. Otherwise next time you restart your computer it’s IP might be different and your URL wont work.

This step is surprisingly simple:

  1. Open your network preferences
  2. Go to the network you use (in my case “Airport”)
  3. Click Advanced (or similar button — I’m using Mac Leopard)
  4. Go to the “TCP/IP” area.
  5. Change the dropdown menu from “Using DHCP” to “Using DHCP with manual address”
  6. Enter the internal IP address you added to the port forwarding setting in your router.
  7. Done

Troubleshooting

If you have any problems with the setup, check out the troubleshooting page at DynDns.

Done

Now you should be able to access your local computer from inside VirtualBox with your new URL.

Share files between two SO is easy because there are different protocols for sharing resources (NFS, CIFS/SMB/Samba, FTP, …), but sharing files between two PCs with OS Linux based, and one of them as virtualmachine guest of another one is a bit more complicated. Here’s how to do it when we Mac OSX as HOST and CentOS as GUEST:

Mount DVD ISO image in CentOS VirtualBox guest

1.- Previously, I have download DVD ISO image, then I have copied to my Mac OSX Host.

2.- From Virtual Box menu, goes to Devices > CD/DVD Devices and mount selecting CentOS’s DVD ISO image (ISO previuosly added to VBox’s “Virtual Media Manager”).

3.- In CentOS guest now you can see DVD iso mounted as /media/CentOS_5.5_Final

4.- You can install packages directly off the mounted DVD ISO. Now, modify /etc/yum.repos.d/CentOS-Media.repo file, enter:

5.- Make sure enabled is set to 1:

6.- Save and close the file. To install packages from only DVD media repo, do this:


Notes:
* –disablerepo=*: disable all yum repo
* -y: assume yes to any question which would be asked
* –enablerepo=c5-media: enable c5-media repo

Install Virtual Box Additions in CentOS guest

Before anything, It is necessary install some packages as compiler gcc, kernel libs and sources.

1.- Install the following packages with CentOS DVD ISO image mounted:

2.- Unmount CentOS DVD ISO image and mount Virtual Box Guest Additions in your CentOS guest:

3.- Restart CentOS guest

4.- Now, install VBoxGuestAdditions in CentOS guest:

5.- Restart CentOS guest again

6.- Now you could use special functionalities as resize the guest windows, share files, etc…

Share files beetwen Mac OS X as Host and CentOS as Guest

1.- In your Host Linux box:

2.- In main menu of your Linux Guest’s Virtual Box:

  • Go to Devices > Shared Folders
  • In popup, add shared folder and select Host’s folder (/Users/chilcano/files2share), set up a name as files2share and make permanent.

3.- In your Guest Linux box opens a terminal window and create a new directory where you’ll mount shared folder

4.- In this terminal, enter the id command and look the output. We will use uid and gid:

Virtualbox Localhost Mac Free

5.- Now, we will mount shared folder from Host to Guest. From terminal in Guest Linux:

Make the Mounted Share permanent

You can make the shared folder mount automatically each time you start the CentOS guest by making an entry in /etc/fstab.

1.- From the CentOS guest edit fstab:

2.- Add a line at the bottom of file, and that looks like this:

3.- Verify mounted folder

In Mac OS X (host):

In CentOS (guest):

4.- End.

Virtualbox Localhost Host Machine

References:

Virtualbox Localhost Mac

  • CentOS: Install Packages Via yum Command Using DVD / CD as Repo
    http://www.cyberciti.biz/faq/centos-linux-install-packages-from-dvd-using-yum/
  • Implementing virtualbox shared folders between a Mac OS X host and Fedora guest
    http://davidherron.com/content/implementing-virtualbox-shared-folders-between-mac-os-x-host-and-fedora-guest

http://forums.virtualbox.org/viewtopic.php?t=4960&highlight=install+guest+addition
* How to install Guest Additions in CentOS 5.1

  • Share Folders Between a Linux Host and Linux Virtual Machine on VirtualBox
    http://tuxtweaks.com/2009/06/share-folders-linux-host-linux-virtual-machine-virtualbox/

Virtualbox Web Server

Tagged with: Linux, Virtual Box
Posted in Open Source, Security