<?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>themattharris.com &#187; windows</title>
	<atom:link href="http://themattharris.com/tag/windows/feed/" rel="self" type="application/rss+xml" />
	<link>http://themattharris.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Mon, 04 Jan 2010 17:35:49 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Locally hosted websites and virtual machines</title>
		<link>http://www.themattharris.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fthemattharris.com%2F2008%2F08%2Flocally-hosted-websites-and-virtual-machines%2F&amp;seed_title=Locally+hosted+websites+and+virtual+machines</link>
		<comments>http://www.themattharris.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fthemattharris.com%2F2008%2F08%2Flocally-hosted-websites-and-virtual-machines%2F&amp;seed_title=Locally+hosted+websites+and+virtual+machines#comments</comments>
		<pubDate>Sat, 09 Aug 2008 01:08:11 +0000</pubDate>
		<dc:creator>themattharris</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[browsertesting]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[hosts]]></category>
		<category><![CDATA[parallels]]></category>
		<category><![CDATA[vmware]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.themattharris.com/?p=51</guid>
		<description><![CDATA[So here&#8217;s the situation. You&#8217;ve got a development copy of a website on your local Macbook and you&#8217;ve been making some changes to it. Everything looks great but you want to make sure you haven&#8217;t made changes that stop the site rendering the way you expect in Internet Explorer or Firefox 2.  Usually you&#8217;d [...]]]></description>
			<content:encoded><![CDATA[<p>So here&#8217;s the situation. You&#8217;ve got a development copy of a website on your local Macbook and you&#8217;ve been making some changes to it. Everything looks great but you want to make sure you haven&#8217;t made changes that stop the site rendering the way you expect in Internet Explorer or Firefox 2.  Usually you&#8217;d make use of your corporate network computers to test the site but your working remotely so don&#8217;t have that luxury. You do, however, have a couple of virtual machines running Windows XP and different versions of browsers.  The question is, how do you test the changes without committing them to the live site?<span id="more-51"></span></p>

<p>The answer is remarkably simple and allows you to test any site hosted on your local machine with browsers installed on your virtual machines. In all of this I am assuming your running Mac OS X and Windows XP in the virtual machine.  That being said, as long as your know your hosts IP address and the virtual machine is running Windows 95 upwards this will work. By host I mean the machine which you run VMWare or Parallels on.</p>

<h2>What you need</h2>

<ul>
<li>A virtual machine application such as <a href="http://www.vmware.com/products/desktop_virtualization.html">VMWare</a> or <a href="http://www.parallels.com/en/desktop/">Parallels</a></li>
<li>A website hosted on your local machine</li>
</ul>

<h2>What to do</h2>

<p>With your virtual machine turned off, edit it&#8217;s settings to ensure it is running the Network card in &#8220;Bridged&#8221; mode.  What this does is allow your virtual machine to appear on your network as if it was another computer, rather that the default NAT mode that hides the virtual machine behind the hosts IP address.</p>

<p>Next start up your virtual machine and whilst it&#8217;s loading, make a note of the hosts IP address. You can find your IP address in the network preferences or through the command <code>ipconfig</code> (Windows) or <code>ifconfig</code> (Linux and Mac).</p>

<p>With the virtual machine now loaded go to Start > Run and type <code>notepad "c:\windows\system32\drivers\etc\hosts"</code>. This will load up the file Windows uses to alias IP addresses to host names.</p>

<p><img src="/content/uploads/2010/01/hosts.jpg" alt="The default Windows hosts file" width="661" height="419" class="alignnone size-full wp-image-202" /></p>

<p>The file is very well explained but in a nutshell, you put the IP address of the host at the beginning of the line, and the domain name that should point to it. So, lets assume my host IP is 10.0.1.97 and the domain I am developing is www.themattharris.com. In the hosts file I would enter a new line as</p>

<p><pre class="brush: plain;">10.0.1.97       www.themattharris.com</pre></p>

<p>Now lets assume i&#8217;m also developing another domain on the host called www.tokofu.com. All I need to do is add another line to the hosts file <pre class="brush: plain;">10.0.1.97       www.tokofu.com</pre></p>

<p><img src="/content/uploads/2010/01/filledin.jpg" alt="Hosts file filled" width="661" height="419" class="alignnone size-full wp-image-201" /></p>

<p>Save the file and test in your virtual machine. The domains you entered into the Windows hosts file will have caused your web browser to request the site from your host and not the Internet.</p>

<p>We can also validate this by running two commands in the Windows Command Prompt. If we run <code>nslookup</code> the computer will lookup the domain name using a DNS server.  If we run the command <code>ping</code> Windows instead uses the address it knows from the hosts file. You can see this by loading a command prompt (Start &gt; Run and type <code>cmd</code> ) and entering <code>nslookup your-domain.com</code> and <code>ping your-domain.com</code></p>

<p><img src="/content/uploads/2010/01/addresscompare.jpg" alt="addresscompare" width="674" height="344" class="alignnone size-full wp-image-200" /></p>

<p>To restore the default behaviour you edit the &#8220;c:\windows\system32\drivers\etc\hosts&#8221; file and either delete the lines you entered, or start the line with a &#35; (this marks the line as a comment).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themattharris.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fthemattharris.com%2F2008%2F08%2Flocally-hosted-websites-and-virtual-machines%2F&amp;seed_title=Locally+hosted+websites+and+virtual+machines/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
