Tag Archives: mac

Viewing localhost in VirtualBox on your Mac

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

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.

Running IE6, IE7 and IE8 on your Mac

UPDATE – May 6th, 2013:

Microsoft has now officially released copies of their OS/Browser bundles for all OSes using VirtualBox, Parallels or VMWare! You can get them from modern.ie.


I use a Mac, which means testing my work in IE6, IE7 and IE8 is a pain. I have Parallels installed but I don’t want to buy extra copies of Windows just to test in IE. Plus, Parallels doesn’t compress the virtual hard drive so each OS takes about 10 – 20GB of space.

The good news is that Microsoft provides free VirtualPC disk images for each of their browsers:

http://www.microsoft.com/downloads/details.aspx?FamilyId=21EABB90-958F-4B…

The bad news is that they wont run on Mac and VirtualPC wont run inside Parallels or VMWare Fusion — but I’ve found a solution! We can convert the disk images to work for VMWare Fusion or VirtualBox.

Setup

First go and download the versions of IE you want to use:


http://www.microsoft.com/downloads/details.aspx?FamilyId=21EABB90-958F-4B…

To do the conversion you’ll need a copy of the Qemu command line tool. I couldn’t get it to work on Mac, so you’ll probably need to use it on a Linux or Windows machine. (you can do this through Parallels or VMWare Fusion too) Download, extract and install Qemu tool on your computer.

Linux

WILL NOT work on windows because it was not compiled to support files over 2GB.
http://fabrice.bellard.free.fr/qemu/

Windows

Download “Qemu-0.9.1-windows.zip” from:
http://lassauge.free.fr/qemu/

VMWare Fusion

This is the easiest way to go and has superior support for shared network and clipboard between Mac and PC, except it means you’ll need to buy a copy of VMWare Fusion. I wrote these instructions using the trial version, someday I’ll buy my own full version.

The process will probably take less than an hour and require about 2Gb of space. These instructions are tailored towards using Windows for the file conversion with qemu. If you’re using Linux you’re probably smart enough to adapt these instructions to your system. Several people in the comments have mentioned being able to use Q on the Mac to do the file conversion.

  1. Open a command prompt: Start > Run and type “cmd”
  2. Use “cd” to go to the directory you download and extracted Qemu.
  3. Run:
    qemu-img.exe convert -f vpc "XP SP2 with IE7.vhd" -O vmdk XPIE7.vmdk

    • “XP SP2 with IE7.vhd” is the path to the IE VPC file you downloaded
    • “XPIE7.vmdk” is the new file that VMWare Fusion will use.
  4. Wait…(will probably take 15 – 30 minutes)
  5. Move the new “.vmdk” file to your mac.
  6. Open VMWare Fusion and click File > New
  7. Go through the wizard and when you get to the “Virtual Hard Disk” page, expand “Advanced disk options”, check “Use an existing virtual disk” and use the dropdown to find the new “.vmdk” file.
  8. Finish the wizard and start it! (If prompted to upgrade the virtual harddrive, click “Yes”)
  9. Ignore any driver dialogs that ask you to insert a Windows CD. The VMWare Tools should install these drivers for you (see next step).
  10. Install the VMWare tools (Virtual Machine > Install VMWare Tools) as soon as Windows boots up. If installing the tools gives you a weird error, read the next section.
  11. You’re done!

Installing the VMWare Tools

If the VMWare Tools wont install automatically follow these simple steps to install it manually:

  1. With VMWare Fusion running click Virtual Machine > Install VMWare Tools
  2. Open your “My Computer” to see which drive letter the CDRom with the VMWare Tools has mounted to.
  3. Open a command prompt: Start > Run and type “cmd”
  4. Type the following and press enter (change “D” to the drive letter from step 2):
    • msiexec -i "D:VMware Tools.msi"
  5. The installation wizard should open and walk you through the rest of the install.

VirtualBox

The great thing with VirtualBox is that it’s free and available for most OSes! The process will take a little longer and will temporarily require about 20Gb – 30Gb of disk space. In the end your IE virtual disk will only be about 2Gb.

You might be tempted to do the VMWare Fusion conversion, outlined above, and use the “.vmdk” file in VirtualBox. It’s true that VirtualBox supports “.vmdk”, but everytime I tried it I ran into massive problems.

These instructions are tailored towards using Windows for the file conversion with qemu. If you’re using Linux you’re probably smart enough to adapt these instructions to your system. Several people in the comments have mentioned being able to use Q on the Mac to do the file conversion.

  1. Open a command prompt: Start > Run and type “cmd”
  2. Use “cd” to go to the directory you download and extracted Qemu.
  3. Run: qemu-img.exe convert -f vpc "XP SP2 with IE7.vhd" -O raw XPIE7.bin
    • “XP SP2 with IE7.vhd” is the path to the IE VPC file you just downloaded
    • “XPIE7.bin” is the new file.
  4. Wait…(will take about an hour)
  5. Move the new “.bin” file to your mac. (or try the next 2 steps on the same machine)
  6. Install VirtualBox
  7. Convert and compress the “.bin” file. (This can also be done on Windows or Linux if you have VirtualBox on that machine)
    1. Open a terminal or command prompt.
    2. Go to the directory where your “.bin” file is.
    3. VBoxManage convertdd XPIE7.bin XPIE7.vdi (FYI: on Windows, VBoxManage is in “C:Program Filesinnotek VirtualBox”)
    4. VBoxManage modifyvdi XPIE7.vdi compact
  8. Open VirtualBox
  9. Click New
  10. Go through the wizard

    • Give it at least 350MB of “Base Memory”
    • Use the new “.vdi” file as the “Boot Hard Disk”.
  11. Finish wizard and start it!
  12. Ignore any driver dialogs that ask you to insert a Windows CD. The VirtualBox tools should install these drivers for you (see next step).
  13. Be sure to install the VirtualBox tools as soon as Windows boots up. (Click: Device > Install Guest Additions)

Now you can have all IE versions running on your Mac. Enjoy!