<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Fragility &#187; virtualbox</title>
	<atom:link href="http://fragility.us/tag/virtualbox/feed/" rel="self" type="application/rss+xml" />
	<link>http://fragility.us</link>
	<description></description>
	<lastBuildDate>Tue, 26 Apr 2011 22:02:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Connect to Your Local Development Sites from VirtualBox Guests</title>
		<link>http://fragility.us/2009/05/connect-to-your-local-development-sites-from-virtualbox-guests/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=connect-to-your-local-development-sites-from-virtualbox-guests</link>
		<comments>http://fragility.us/2009/05/connect-to-your-local-development-sites-from-virtualbox-guests/#comments</comments>
		<pubDate>Mon, 18 May 2009 21:51:01 +0000</pubDate>
		<dc:creator>pete</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[mac os x]]></category>
		<category><![CDATA[virtualbox]]></category>

		<guid isPermaLink="false">http://test.fragility.us/?p=25</guid>
		<description><![CDATA[Like many web developers, I do most of my work with a web server running on my local machine.  In my case, I'm running Apache HTTPD from MacPorts on my MacBook Pro, and I have various sites in development using either Ruby or PHP.  Due to the nature of the projects, or simple because it's a good idea, I prefer to test my sites in various browsers, including Internet Explorer, which is not available on Mac OS.  So, I've set up multiple virtual machines using the freely available <a href="http://www.virtualbox.org/">VirtualBox</a>. <a href="http://fragility.us/2009/05/connect-to-your-local-development-sites-from-virtualbox-guests/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Like many web developers, I do most of my work with a web server running on my local machine.  In my case, I&#8217;m running Apache HTTPD from MacPorts on my MacBook Pro, and I have various sites in development using either Ruby or PHP.  Due to the nature of the projects, or simply because it&#8217;s a good idea, I prefer to test my sites in various browsers, including Internet Explorer, which is not available on Mac OS.  So, I&#8217;ve set up multiple virtual machines using the freely available <a href="http://www.virtualbox.org/">VirtualBox</a>.</p>
<p>I&#8217;ve set up aliases to localhost, and corresponding NameVirtualHost settings for Apache, on my Mac for each of the sites I&#8217;m developing.  Then I can just enter, for example, &#8220;myproject.local&#8221; in my browser, and view my work in progress.  (I use the nice Ruby gem &#8220;<a href="http://github.com/bjeanes/ghost/tree/master">ghost</a>&#8221; to manage aliases.)  However, this doesn&#8217;t work with a default VirtualBox guest, so below is my method for getting this to work.</p>
<h2>Start the VirtualBox VM Manager</h2>
<ol>
<li>To begin, start your install of VirtualBox.  I believe that you need at least version 2.2.0, which introduced host-only networking.<br />
<img class="alignnone size-full wp-image-9" title="vbox_start" src="http://test.fragility.us/wp-content/uploads/2009/08/vbox_start.png" alt="vbox_start" width="642" height="487" /></li>
<li>Open the settings for the desired VM and navigate to the Network tab.  You should already have something in the Adapter 1 section.<br />
<img class="alignnone size-full wp-image-6" title="vbox_adapter1" src="http://test.fragility.us/wp-content/uploads/2009/08/vbox_adapter1.png" alt="vbox_adapter1" width="568" height="338" /></li>
</ol>
<h2>Add a Local-Only Network Interface</h2>
<ol>
<li>Click on the Adapter 2 tab.  You should typically see a disabled interface, something like this:<br />
<img class="alignnone size-full wp-image-7" title="vbox_adapter2" src="http://test.fragility.us/wp-content/uploads/2009/08/vbox_adapter2.png" alt="vbox_adapter2" width="568" height="338" /></li>
<li>Enable Adapter 2 by checking the box.  Then change the &#8220;Attached to:&#8221; box to &#8220;Host-only Adapter.&#8221;  The Name box shows &#8220;vboxnet0&#8243; on my install:<br />
<img class="alignnone size-full wp-image-8" title="vbox_adapter2_new" src="http://test.fragility.us/wp-content/uploads/2009/08/vbox_adapter2_new.png" alt="vbox_adapter2_new" width="568" height="338" /></li>
<li>Save your settings and start your virtual machine.</li>
</ol>
<h2>Verify Host-Only Adapter Address</h2>
<p>VirtualBox should create a new network interface on your host OS that is used for host-only networking.  On Mac OS, verify this by entering the following in a Terminal:</p>
<p>ifconfig vboxnet0</p>
<p>You should see something like the following.  Note the IP address &#8211; you will need it later:</p>
<p>vboxnet0: flags=8943</p>
<h2>Set up Guest OS</h2>
<p>You need to set up host aliases in your guest OS that match those you set up in your host, only that you will point them to the IP address you noted previously.  The following instructions apply to Windows XP and newer.</p>
<ol>
<li>Open your hosts file.  Use Start -&gt; Run&#8230; and enter &#8220;notepad c:WINDOWSsystem32driversetchosts&#8221;.  <strong>UPDATE</strong>: On Windows Vista and Windows 7, there are additional protections on this file.  You will have to run Notepad (or your favorite text editor) as Administrator first &#8211; right click on its shortcut and choose &#8220;Run as administrator.&#8221;</li>
<li>Add a line to the file that associates your host-only IP address with your development site aliases.  The IP address comes first, followed by each alias, separated by spaces.
<pre><code>192.168.56.1    myproject.local otherproject.local</code></pre>
</li>
</ol>
<h2>Test the Configuration</h2>
<p>As long as your local web server is running on the host OS, you should be able to enter one of your site aliases in the guest&#8217;s browser and get the expected results.</p>
]]></content:encoded>
			<wfw:commentRss>http://fragility.us/2009/05/connect-to-your-local-development-sites-from-virtualbox-guests/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

