I’ve got VS2010 installed as an application inside XP mode which is fantastic except that I really rather wanted to use the instance of SQL 2008 installed on my Windows 7 box rather than the instance of SQLExpress that VS2010 can install with itself. And, should you need to do this yourself, this is how you do it…
- Install the Loopback Network Adapter on your Windows 7 machine
- Set the Loopback Adapter to have a static IP address which the VPC network adapter will use as its internet gateway
- Configure the XP Mode Virtual Machine to use the loopback adapter as its gateway.
- You should now be able to ping your host machine from your guest OS.
- Open SQL Server connections via TCP/IP on host machine [updated 24/12]
- Open incoming connections on port 1433/1434 for windows firewall
- You should now be able to telnet to port 1433 on the host OS from XP mode
More detailed instructions for each of these steps after the break.
Install Loopback Adapter
- Be logged on as Admin or run Computer Management Admin Tool as Administrator
- Choose Device Manager (can't directly run DM as admin from System Control Panel)
- Right click system icon. Select 'Add Legacy Hardware'
- Click Next
- Choose 'Install the hardware I manually select from a list'. Click Next
- Choose Network Adapters. Click Next
- Choose Microsoft as the Manufacturer and Microsoft Loopback Adapter. Click Next
- Click Finish. The Loopback Adapter is now in your list of devices.
Set the Loopback Adapter to have a static IP address which the VPC network adapter will use as its internet gateway
- Open Control Panel > Network and Sharing Center
- Click Change Adapter Settings on the left hand side
- You'll see a new Local Area Connection has appeared with no network access. Switch to details view and you'll see this is for the loopback adapter.
- Right click this new connection and click Properties.
- (optional) Uncheck 'Internet Protocol Version 6' unless you absolutely need it
- Select 'Internet Protocol Version 4' and check properties
- Check 'Use the following IP address' and give the adapter a static IP address such as 192.168.3.1. Add the same address as the default gateway. The subnet will automatically fill in as 255.255.255.0.
- Click OK twice
Configure the XP Mode Virtual Machine to use the loopback adapter
- Run the XP mode machine.
- Choose Tools > Settings
- Select Networking from the left hand pane.
- Set an adapter to 'Microsoft Loopback Adapter'
- Now choose Start > Control Panel > Network Connections
- Right click Local Area Connection and select Properties
- Choose Internet Protocol and click Properties
- Check 'Use the following IP address' and give the adapter the static IP address 192.168.3.2. Add the address you gave to the loopback adapter to the default gateway, e.g. 192.168.3.1. The subnet will automatically fill in as 255.255.255.0.
- Click OK and then close.
You should now be able to ping your host machine from your guest OS.
Open SQL Server connections via TCP/IP on host machine
- Choose Start > Microsoft SQL Server 2008 > Configuration Tools > SQL Server Configuration Manager. You'll need to run it as an administrator.
- Choose "SQL Server Services" and stop the service for your SQL Server instance. If you don’t run
SQL Server Configuration Manager as admin, you won’t be able to stop the services but you won’t be given a UAC prompt…
- Choose "SQL Server Network Configuration" > Protocols for SQL2K8.
- Enable TCP/IP (and Named Pipes if needed)
- Double click the TCP/IP entry. You’ll be presented with a list of IP addresses that SQL server is listening for connections on. Change one of the IPv6 addresses to read 192.168.3.1, set it as both active and enabled.
- Now scroll down this dialog to see the section marked IPALL. Add 1433 as the TCP port all connections should come in on.
- Click OK after you’ve made those changes.
- Return to "SQL Server Services" and restart the service for your SQL Server instance
- Also start the SQL Server Browser service which lets incoming clients see your SQL server instances.
Open incoming connections on port 1433/1434 for windows firewall
- Choose Control Panel > Windows Firewall > Advanced Settings
- Select Inbound Rules on the left hand panel and then New Rule from the right hand side
- Select Port, then Next
- Set TCP port 1433 and then Next
- Select "Allow the connection" and then Next
- Choose the type of network it should be allowed on. Click next.
- Set name to SQL Server, then Finish.
- Repeat for UDP port 1434. Call is SQL Server Browser
- Finally, select ‘Allow a program or feature through Windows Firewall’.
- Click ‘Allow another program’.
- Click ‘Browse’ and find sqlservr.exe. It is typically in C:\Program Files\Microsoft SQL Server\100\<instancename>\MSSQL\Binn. Then click Open and then Add.
- Set the newly created entry for ‘SQL Server Windows NT’ to open for both Private and Public networks.
- Click OK.
You should now be able to telnet to port 1433 on the host OS from XP mode
If you can’t, then start diagnosing the issue by checking whether or not it is a firewall issue.
- Choose Control Panel > Windows Firewall.
- You’ll be able to discover whether the firewall considers the network created by the loopback adapter as Public or Private.
- Click ‘Turn Windows Firewall on or off’
- Turn off the firewall for the appropriate public or private zone and click OK.
- Try and telnet to the host OS on port 1433 from the XP Mode virtual machine. If it connects, it’s a firewall issue, if not, then go back over the loopback installation steps.
- Switch the firewall back on for the zone.
If it is the firewall, try the firewall troubleshooter.
- Choose Control Panel > Windows Firewall.
- Click ‘Troubleshoot my network’
- Click ‘Incoming Connections’ and then click Next
- When asked what you want to troubleshoot, click ‘Something Else’ and then Next.
- Browse to find the sqlservr.exe program found earlier and click Next. Follow the prompts from the wizard.
One final note. VS2010 inside XP Mode only seems to recognize the instance of SQL Server on the host OS by the name of the host machine. In my case, BLACKBOX rather than BLACKBOX\SQL2K8 as I was expecting. Odd, but hey it works. Thankfully.