Networking Mac and Windows with VMWare

July 5, 2008

This blog post was written in 2008. Information and links in this post may be outdated.

I recently discovered how easy it is to view my local development websites on multiple OS's using VMWare. I use this primarily to see how awful my apps look in IE. Here's how you can do it too:

Step1: Get Setup (the expensive part)

  • Buy a mac
  • Buy VMWare Fusion
  • Buy Windows. Yes - if you want to run IE6 and IE7 you'll have to buy two licenses. Yes, it will take you several hours of frustration and several hours on the phone with MicroSoft to get your licenses installed with VMWare.
  • Download a few real OS's and add them as virtual machines

Step 2: Find your network address

When you installed VMWare, it configured all of the necessary IP addresses for you. To find out what they are, open Terminal and type:

ifconfig

You'll see something like:

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
  inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
  inet 127.0.0.1 netmask 0xff000000
  inet6 ::1 prefixlen 128
  inet6 fdd3:5091:e6df:4c3d:21b:63ff:feab:d72e prefixlen 128
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
  ether 00:1b:63:ab:d7:2e
  media: autoselect status: inactive
  supported media: autoselect 10baseT/UTP <half-duplex> 10baseT/UTP <full-duplex> 10baseT/UTP <full-duplex,hw-loopback> 10baseT/UTP <full-duplex,flow-control> 100baseTX <half-duplex> 100baseTX <full-duplex> 100baseTX <full-duplex,hw-loopback> 100baseTX <full-duplex,flow-control> 1000baseT <full-duplex> 1000baseT <full-duplex,hw-loopback> 1000baseT <full-duplex,flow-control> none
en1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
  inet6 fe80::21c:b3ff:fe7c:916e%en1 prefixlen 64 scopeid 0x5
  inet6 2002:4452:63ee::21c:b3ff:fe7c:916e prefixlen 64 autoconf
  inet 10.0.1.199 netmask 0xffffff00 broadcast 10.0.1.255
  ether 00:1c:b3:7c:91:6e
  media: autoselect status: active
  supported media: autoselect
fw0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 4078
  lladdr 00:1d:4f:ff:fe:73:a1:ba
  media: autoselect <full-duplex> status: inactive
  supported media: autoselect <full-duplex>
vmnet8: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
  inet 172.16.192.1 netmask 0xffffff00 broadcast 172.16.192.255
  ether 00:50:56:c0:00:08
vmnet1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
  inet 172.16.43.1 netmask 0xffffff00 broadcast 172.16.43.255
  ether 00:50:56:c0:00:01

Notice the last entry, vmnet1 - the inet address listed there is the address that all of your virtual machines can use to access your localhost. In my case, this is 172.16.43.1

Let's say you have a local rails app running on http://localhost:3000/ - to access that app from anywhere (your mac or any or your virtual machines) just type http://172.16.43.1:3000/ in your browser.

References

Tags