I wrote a guide on how to set up your Virtual Server 2005 environment, so that your VM can talk with your host.
This is a very generic requirement, often needed by developers working with server products such as SharePoint.
Virtual Server Network Settings
Matthew Cosier
Change Log
Friday, April 28, 2006
Friday, May 19, 2006
Monday, May 22, 2006
Tuesday, May 23, 2006
Setting up a loopback adapter
Navigate to control panel
Click add hardware
Click Next
Click “Yes, I have already connected the hardware”
Scroll down and choose “Add new hardware device”
Choose “Install the hardware that I manually select from a list (Advanced)
Choose “Network Adapters” then click Next
From the list on the left, choose “Microsoft”
From the list on the right choose “Microsoft Loopback Adapter”
Click Next
Click Next
Click Finish
Configuring Internet Connection Sharing
With the “Network Connections” window still open, right click your primary network adapter (typically “Local Area Connection” (for Cable/Ethernet) or “Wireless Network Connection” if you are using WiFi for your external internet access) and select ‘Properties”
Click the “Advanced” tab from within the properties dialog
Check the “Allow other network users to connect through this computer’s Internet Connection” check box
Note that if you have more than one adapter on your machine – it will ask you to choose the one that connects internally to your LAN, and will assume the current adapter you are changing settings on is the one which connects to the internet. This is so that you can share your internet connection in a LAN environment – either by Ethernet, or some other medium such as a PAN enabled Bluetooth connection. In this situation, choose your Loopback adapter from the list. By doing this, you are telling ICS that you intend on sharing the internet connection of your primary adapter with those who are connected to you through your loopback adapter.
Click OK
This will enable ICS, and start a local windows DHCP server on the 192.168.0.* subnet which your VM will use to renew an IP address. Your Loopback adapter should no longer say “Limited Connectivity”, as the host will automatically assign a static IP of 192.168.0.1 to the adapter, which is subsequently on the same subnet as the ICS DHCP server.
Important Note:
If you are sharing your internet connection to any other adapter other than your local loopback adapter (i.e., a connection is shared to another physical adapter or medium, such as your corporate LAN (this includes not explicitly choosing the loopback adapter from the list in 3 a – if you select to provide to only your loopback adapter, this should be irrelevant and shouldn’t cause you any problems)) and the network you are sharing to is living happily on the 192.168.0.* subnet, then you are going to have conflict issues. You will essentially be introducing a DHCP server on the LAN which will have the potential to override that of the main corporate DHCP server.
By default, ICS DHCP server will run on the 192.168.0.* subnet, and if your LAN is running on the same subnet, all of the clients on that network are potentially at risk of indecently renewing an IP address from your ICS host, instead of their intended corporate LAN DHCP server – giving them access to your shared internet connection, but losing all connectivity inside the corporate network.
Unfortunately, if you wish to introduce an ICS host on a network running on the 192.168.0.* subnet, you are going to have issues. The only way around it, is to change your LAN so that it will run on a different subnet. To do this, you will need to consult your LAN administrator, or your router configuration documents, to learn how to get your router to provide IPs on a different range. A good suggestion is to have your LAN use the 192.168.2.* range. This unfortunate problem will occur on most default home networks, as most routers will assume the default subnet of 192.168.0.*
Configuring your Virtual Server
Open your Virtual Server Administration Web Site
Click the Create button under the “Virtual Networks” menu
Type “LoopBack” for the virtual network name
Select “Microsoft Loopback Adapter” from the drop down list
Check the ‘connected’ check box, next to your virtual machine name, so that it will automatically configure your VM to use this connection.
Click OK
Note: To add a new network adapter (rather than changing the one that is already there) your virtual machine must not be in a running state.
Obtaining your Virtual Machine’s network address
Turn on your Virtual Machine
Within your virtual machine, open a command prompt by clicking Start->Run->cmd.exe then click OK
Type ipconfig
Under the Local Area Connection adapter, your IP address will be displayed. Note this address, as it is the address that will be used to connect locally to your virtual machine from your host
Open internet explorer to check that you now have an internet connection from within side your VM
Alternatively
Your VM has obtained its IP address through the local DHCP server on your host. In step 4, you will also have noticed the Connection-specific DNS Suffix was set to mshome.net. This is the default suffix that is used by ICS DHCP server. You can access your VM by taking advantage of domain name resolution by using %VMsMachineName%.mshome.net on your host.
Accessing your VM from the host
You will now have access to the virtual machine on the host via the IP retrieved in step 4, or the DNS name discussed above. To access the machine from the host:
1. Click start -> run -> cmd.exe and click OK
2. Type \\%ip-dns%\c$
a. Note, replace %ip-dns% with the IP retrieved from step 4, or your VM’s machine name .mshome.net
You can now map network drives to that address, and create TCP port forwarding on the host if need be.
Top work Matty. I know that I’ll need this one day. Added to my del.icio.us list.
Hi Matthew,
My host is connected to my Corporate Network. If I enable ICS on the primary adapter, wont I then potentially be issuing IP address to other corporate machines (not desired)?
LT.
Hi LT,
You announce a good point – something I had forgotten to place in my post (and the corrosponding document).
As we know, ICS will start a DHCP server on the host machine – often the problem here, is that most people run their local networks (I guess this even applies to some corp nets) on the 192.168.0.* subnet. Unfortunately, the DHCP server will use the same subnet/ip range.
When using this solution on a LAN which is on the 192.168.0.* subnet, there’s no way around it. You will need to change your network to use, for instance, the 192.168.2.* range instead – this way, there will be no conflicts.
So I think your question is confused by the fact that the host becomes a DHCP server, and it may then try issue IPs to other people on the network – and yes, the answer is it will if your network is on that particular range. If people on your network are closer to your machine on the network nodegraph – your host will try to respond to their dhcp request if they are not specifying a dhcp server directly (I think).
I had to change my home network to use the 192.168.2.* subnet by altering my routers configuration settings – if you check out your routers docs, it should show you how its done – and if you’re like me, you’ll just go directly into the configuration manager for your router and find 192.168.0.* and change it over.
I haven’t tried working out if there’s a way of changing which subnet the ICS DHCP server uses – let me know if you can find this out
Cheers,
Matt
Please note that I have updated the post to incorporate this information.
Cheers,
Matt
Thanks Matt.
I’ll do some more research into other ways of utilising my corp Internet connection. If I was to let an unauthorised DHCP server loose on the wire, I’d be choked to death with that exact same wire
I did the configuration, but I still can’t access my virtual matchine from my host. Could it be my network setup on my virtual matchine? Please help
Very clever idea, this was great help.