Panasonic Youth rob sanheim writes about software, business, ruby, music, stuff and things



Posted
11 December 2007 @ 8am

Tagged
GTD, Macintosh, Rails, Ruby

Discuss

Creating a Static Loopback Address to use in VMWare

The problem: you want to be able to always use the same address in VMWare Fusion for your local Mac web server(s), to test IE6 and IE7 with apps as you dev locally. You normally connect via DHCP, so you can’t depend on your IP address being constant. You can’t use localhost or 127.0.0.1 within VMWare, because that just points back to the Windows box.

Annoying manual solution: Everytime you fire up VMWare to work in IE you need to copy your ip from the Mac side and paste it into IE, adding http:// to the front and the port on the back. This an annoying manual process that doesn’t seem like it should be necessary. Searching vmware’s site and forums doesn’t turn up much, and using the local hostname is unreliable.

The awesome solution: Setup an an additional IP pointing at the loopback interface, which will allow always connecting to your Mac from within VMWare, regardless of your internet connectivity. Run the following line from terminal to do this:

sudo ifconfig lo0 inet 10.0.0.100 netmask 255.255.255.0 alias

Start up some server locally, and hit http://10.0.0.100 - it should work both from your Mac and within VMWare fusion. (You can substitute any private IP for the 10.0.0.100 address)

To make this change persistent, add the line above, without the sudo in front, to your /etc/rc.local file.

update: Wade blogged his experience on figuring this out from the sysadmin side. Thanks Wade!


3 Comments

Posted by
Acrobatic
4 January 2008 @ 5pm

awesome… easy solution for a tough problem. The hardest part was asking Google the right question to get me to this page.


Posted by
Luke
13 January 2008 @ 11am

hi thanks to you and Wade for this - very useful! I have a particular issue though, that I run virtual hosts on my Mac - eg I can just type http://myapp or http://myother-app into the browser and it loads up a different app - useful for Rails and PHP development I find. But on the windows browser, it only loads up the default one, is there a way to do this do you know? I am not very clued in on all this stuff (obviously!) and I just followed a nice tutorial on Leopard to get the different aliases set up.


Posted by
Rob
13 January 2008 @ 9pm

Hi Luke,

You may also have to add the local app names to your windows host file. You can find more details on that file here:

http://vlaurie.com/computers2/Articles/hosts.htm


Leave a Comment

Fixing Textmate Test Issues - `blank_slate_method_added’: stack level too deep (SystemStackError) I can has laptops?