Thursday, March 4, 2010

Windows Virtual PC: Network Between Host and VM Using Loopback Adapter

If you want to create a network between the host and VM using Windows Virtual PC in Windows 7 then this guide is for you.  This is especially useful if you need to communicate with the VM when not connected to a network.  WVPC offers a number of networking options:

  • None – no networking
  • Internal Network – Network between hosted VMs (but not the host)
  • NAT – Sets up a virtual NAT to allow the VM to access the internet
  • Bridge – Allows the VM to use one of the hosts network adapters to access the local network

I do all my work from my laptop, including hosting my VM so at home, when connected to my home network (LAN) i use the bridged mode – my laptop connects using the wireless adapter and the VM uses the Ethernet adapter.  This way i can see both the host (laptop) and VM on the network and they can talk to each other great.  The problem arises when i am travelling and not connected to a network – in this scenario bridged mode is no use because there is no network for the VM and laptop to communicate to each other.  What I want is a ‘host-only’ network mode, similar to what VMWare offers.  The following steps allow you to set up a local bridged network that allows the two to communicate on a private network:

Setup a loopback adapter on the Windows 7 host

  1. In the start menu type command, right-click Command Prompt and select Run As Administrator to open a command window with administrator privileges
  2. Type hdwwiz and press enter to start the Add Hardware Wizard
  3. Click Next
  4. Select Install the hardware that i manually select from a list (Advanced) and click Next
  5. Select Network Adapters from the list and click Next
  6. Select Microsoft in the Manufacturers list and then select Microsoft Loopback Adapter in the Network Adapter list and then click Next
  7. Click Next to install the loopback adapter

See here for the above instructions including images of each step.

Configure the loopback adapter

  1. Go to the Network & Sharing Centre (from the start menu)
  2. Click Change Adapter Settings from the list on the left
  3. Go to the properties of the Microsoft Loopback Adapter
  4. Disable all items, except Client For Microsoft Networks, Virtual PC Network Filter Driver and Internet Protocol Version 4 (TCP/IPv4).  If the Virtual PC Network Filter Driver is not enabled, the VM will not see the adapter
  5. Go to the properties of the IPv4 protocol and set the IP to a reserved private IP, such as 192.168.x.x or 10.x.x.x, that does not conflict with any other network you will connect to.  Ensure that the gateway is left BLANK otherwise it may cause issues with other networking
  6. Click OK until the dialogs are all closed
  7. Open regedit and browse to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}
  8. Find the subkey (0001 … 00xx) that corresponds to the loopback adapter (DriverDesc = Microsoft Loopback Adapter)
  9. Add a DWORD called *NdisDeviceType (don’t forget the asterisk at the start) with a value of 1
  10. Go to the start menu and type View Network Connections to open the list of network adapters
  11. Disable then enable the Microsoft Loopback Adapter to apply the registry changes.  The loopback adapter will no longer appear in the Network and Sharing Centre but will operate as a network endpoint on a private network, which is exactly what we want.  See here for more information.

See here for a thread discussing the registry change

Configure the VM to use the loopback adapter

  1. Ensure the VM is shutdown (not hibernated) to simplify the following steps
  2. Right click the virtual machine .vhd file and select Settings
  3. Change the network adapter to use the new loopback adapter (if you cant see it in the list, check that the filter driver mentioned above is definitely enabled on the host)
  4. Save the settings and run ipconfig from the command-line to check the IP has been successfully set
  5. Start the VM

Configure the loopback adapter in the VM

  1. Go to the properties of the Local Area Network connection in the VM
  2. Go to the properties of the IPv4 protocol and use an IP on the same subnet as the host (eg if the host is 192.168.1.1, use 192.168.1.2 for the VM)
  3. Save the settings and run ipconfig from the command-line to check the IP has been successfully set

Note that pinging does not appear to work using this configuration, even when IP addresses are specified.  However i have been able to successfully perform all other network operations without problem.  The drawbacks with this approach are that the VM cannot communicate to the hosts network when it is connected.  In this scenario, either change the VM to bridge via a different, connected adapter on the host as outlined above, or setup a proxy on the host that can forward requests from the VM to the network.

Monday, February 8, 2010

Setting up Windows 7 VPN Server

A few notes on setting up a VPN server in Windows 7 i have found while doing so on my home computer.

Setup the VPN server by following this guide

Test the VPN server from a computer outside the network (ie dont try and connect from a local computer – some consumer routers wont let this happen and can confuse the issue)

Note that TCP port 1723 must be forwarded as well as IP port 47 (GRE) traffic, details of which are explained here

If the VPN connection is not working, then there are some tools from Microsoft to debug the issue.  Download the tools from here, start pptpsrv.exe on the VPN server and then run the pptpclnt.exe tool on the client.  This will allow you to determine if the traffic is getting through as required.

NOTE: You need to stop the Routing and Remote Access () service so that the server exe can bind to port 1723, otherwise this will not work!

It can also be useful to put your PC in the DMZ in your router temporarily to eliminate blocked traffic as a potential issue.

Hopefully at this point you have a working secured VPN.

Thursday, January 21, 2010

Official BlueSoleil Driver Support For Macbook Pro Unibody Bluetooth Coming Soon!

Some exciting news for MBPU users running Windows – I raised an issue with BlueSoleil support and they have contacted me RE supporting the BT hardware in the Macbook Pro Unibody laptop line-up.  I have been corresponding with them and sending stack traces, etc so that they can officially add the hardware to an upcoming release.  This means no more hacking required to get BT to work – yay!  I’ll let you know when i know more as they have promised to contact me for testing before it is released.

Bootcamp 3.1 Update Released

So Apple finally got around to releasing the update to the Bootcamp drivers which officially support Windows 7.  I have them installed now and as expected there is basically nothing to write home about.  Nothing has been improved or added that couldn’t be achieved before.  I guess the difference now is that instead of having to manually extract and install a bunch of drivers, they are all packaged correctly so that everything is fixed in this latest release.  Oh did i say everything?  I mean everything except the fact that the sound levels are still screwed.  My gosh how hard is it Apple!  Sure the SPDIF light does not stay on when in use but the sound volume level through the speakers is very low and the centre speaker does not appear activated.  Anyway its a step forward – download them here (64-bit) and here (32-bit).

Sunday, October 11, 2009

Procreate 1.1.1 Released!

Procreate 1.1.1

This minor release of Procreate fixes the following issues:

  • Support for 64-bit versions of Windows
  • Support for XNA 3.1 (3.0 or greater required)

You can download the latest version from the Procreate homepage.  Thanks to all who provided feedback.

Saturday, October 10, 2009

Wake On LAN (WoL) Magic Packet Sender Utility

Do you want a small, self-contained utility to remotely wake your computer?  As promised here is a utility you can use to do just that. This small utility offers the following features:

  • Wake a computer from a location that is external to the LAN
  • Wake a computer from within the LAN
  • Automatically store any number of host configurations for repeated use

Abracadabra WOL utility

Follow this guide to ensure your computer is setup correctly for use with WoL. If you are behind NAT or a firewall, ensure the port you specify for each host in the utility is forwarded to the relevant computer. At this point you may be wondering why i chose to write yet another WoL utility when there are already several free alternatives available. The problems i found with existing solutions could be grouped into one or more of the following:

  • Many utilities try to send a broadcast packet to the destination host from a location external to the LAN. 99% of consumer routers block these kinds of packets because they are commonly used in hacker attempts - hence the packet never makes it to the host. This utility does not use broadcast packets when sending externally so it does not suffer from this issue
  • The inability to wake hosts both externally and internally (broadcast is used internally since IP is not known)
  • The inability to save host configurations, requiring the details to be re-entered every time you want to wake a host

This motivated me to write this utility which allowed me to provide all the above functionality. Hopefully you find it useful – feel free to leave a comment if you want something improved or find it useful. Oh and browse the source if you are new to WPF and want to know how to write a simple app. Note that you will need at least the .NET framework 3.5 installed to run this application. This comes included with Windows 7.

Executable

Source Code

Monday, October 5, 2009

Divided Registry In 64-bit Windows

Ever tried to run an old program under a 64-bit OS and found that it just wont work, even when you try every possible compatibility mode setting and running as Administrator?  Many people don’t realise that there are some key differences that can often prevent a program from working.

Both Program Files and the registry are split into 32/64 bit variants, in case there are 2 versions of the same program that need to be installed.  This recently caused an issue for me where i had to manually apply a registry patch to get the game to ‘work’ – under Windows XP it worked fine but would not work under Windows 7 64-bit.  The reason was because by default, the registry patch gets applied to the 64-bit registry, however the game was looking in the 32-bit registry.  The easiest way to solve this is to use the 32-bit version of regedit to apply the registry patch.  You can start it by running:

%systemroot%\syswow64\regedit

Then open and apply the registry patch.  See here for more information