Geeks With Blogs

News This is the *old* blog. The new one is at blog.sixeyed.com
Elton Stoneman
This is the *old* blog. The new one is at blog.sixeyed.com

[Source: http://geekswithblogs.net/EltonStoneman]

The aim of putting together a single VM and sharing it around a dev team soon hits the problem that multiple computers with the same name are trying to connect to the Windows network. The first VM to connect will be correctly registered, but subsequent images will get a network error: "Computer name already exists".

The problem is that you once you build up a dev environment (with SQL Server, BizTalk etc.) the computer name quickly becomes integral and changing it is very difficult (in the case of BizTalk, sufficiently difficult that it's not worth even trying). Having a base image with just the operating system means new copies could be taken and the name changed easily – but that defies the point of having one configured machine, as every new joiner needs to install the rest of the environment themselves.

A couple of alternatives are available:

  • Alan Smith describes setting up a partial image using SysPrep and scripts which run the first time a new image is used. Each VM then has a unique name and the scripts handle the remaining installations. This sounds like a good solution for full integration with your network, but there are additional setup costs and it's not much help if you already have a VM in use;
  • Simon Hutson uses a combination of network adapters in Virtual PC to hide the VM's computer name from the network, but still have access via the host machine. This sounded exactly what I wanted, but I couldn't get it communicating on the network with DNS, only using IP addresses (my VM is not configured as a DNS server so that may be the issue – but setting up DNS on the VM seems like overkill unless you need it anyway).

My solution is an extension of Simon's, basically using Shared Networking in Virtual PC , disabling Client for Microsoft Networks and File and Printer Sharing for Microsoft Networks and WINS so the VM doesn't try to register itself with the network. You also need the second network using the Loca adapterl, which you configure with a static IP – an address in the range 10.0.0.x, and a subnet mask of 255.255.255.0 works consistently – and specify your network's real DNS servers.

This gives you TCP/IP access, and then you can resolve the machine names you need to connect to using the HOSTS file local to the VM. Obviously this is only suitable for accessing machines on the network with static IP addresses, and means network machines can't connect to your VM by name, but if you can live with that it's a very simple workaround. The image can be set up with the network adapters configured, and the HOSTS file already prepared so it's ready to go for new joiners.

Note that Windows Server 2003 as a guest OS will need to use a dedicated DNS address for the Shared Networking adapter: 192.168.131.254 – see Virtual PC Guy's post on using NAT with W2K3 for details on this.

In case it's been a while… The HOSTS file is a simple IP address/computer name lookup table which you'll find in %SystemRoot%\system32\drivers\etc\ (by default), which you extend by adding entries on a new line. Mine looks like this:

127.0.0.1    localhost

10.5.1.1    SVRNAME1

10.5.1.2    SVRNAME2

 

- and now we have multiple Virtual PCs with the same name connecting to the network, and happily using source control, database and build servers, without trashing our BizTalk install. A script to refresh the HOSTS file from a central location is a simple extension if your list is likely to change.

Posted on Thursday, December 11, 2008 6:59 PM Annoying problems , Virtual PC | Back to top


Comments on this post: Networking Virtual PCs with the Same Computer Name

# re: Networking Virtual PCs with the Same Computer Name
Requesting Gravatar...
I have been searching about this. I am a networking student...It's really helpful for me. Thanks a lot for sharing.
Left by Hohlkammerplatten on Oct 12, 2010 10:31 AM

# re: Networking Virtual PCs with the Same Computer Name
Requesting Gravatar...
I have been searching about this. I am a networking student...It's really helpful for me. Thanks a lot for sharing.
Left by Hohlkammerplatten on Oct 12, 2010 10:31 AM

# re: Networking Virtual PCs with the Same Computer Name
Requesting Gravatar...
I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.
Left by air freight on Dec 08, 2010 11:29 AM

# re: Networking Virtual PCs with the Same Computer Name
Requesting Gravatar...
I would like to thank you for the efforts you have made in writing this article.Thanks.Would be waiting for more stuff from yourside.
Left by Fly Ash Transportation on Mar 09, 2011 10:40 AM

# re: Networking Virtual PCs with the Same Computer Name
Requesting Gravatar...
Virtualization is one of the most promising computer technologies today. Virtualization technologies possess a huge potential and enter Top Three of the fastest growing ones. Microsoft offers virtual network type to let a virtual machine provide services to an extranet.
Left by Cotton Bags on May 02, 2011 7:20 AM

# re: Networking Virtual PCs with the Same Computer Name
Requesting Gravatar...
How if you used Simons modification in dedicated networking in virtual PC?
Left by on line degrees on May 13, 2011 8:25 AM

# re: Networking Virtual PCs with the Same Computer Name
Requesting Gravatar...
This is a good post and with this “worldwide web” it will reach all corners of earth in seconds, technological advancements are making this world a much smaller place and being a small entertainment group that travels worldwide at short notice, yes its surely becoming a smaller place... :-) Indian escorts London
Left by London Escorts on Jun 05, 2011 12:07 AM

# re: Networking Virtual PCs with the Same Computer Name
Requesting Gravatar...
Good trick Elton !! I don´t have this issue right now but I bookmark this page in order I can need these advices later
Left by abalorios on Jun 24, 2011 11:01 PM

# re: Networking Virtual PCs with the Same Computer Name
Requesting Gravatar...
Networking Virtual PCs thanks for this useful informattion,
i like your blog, good work.
Left by Kansas City Weight Loss on Sep 30, 2011 6:40 AM

# re: Networking Virtual PCs with the Same Computer Name
Requesting Gravatar...
That's a great post. Each & every tips of your post are awesome. I have been wondering about this topic,so thanks for writing.
Left by Teamspeak rental on Jan 21, 2012 8:02 AM

# re: Networking Virtual PCs with the Same Computer Name
Requesting Gravatar...
I just like the approach you took with this subject.
It isn’t every day that you discover something so concise and enlightening.
I just would like to give a huge thumbs up for the great info you have
here on this post. I will be coming back to your blog for more soon
Left by torte on Mar 20, 2012 12:39 PM

Your comment:
 (will show your gravatar)


Copyright © Elton Stoneman | Powered by: GeeksWithBlogs.net