Create a private network inside my Windows 7 machine

12

1

My Main Rig is a Windows 7 Professional laptop. On this machine is two Virtual Machines, both of which are also Windows 7 Professional. I need these VMs to be able to see each other but I also need them to access to the internet.

Currently they are all connected to the public internet at the hotel I am staying at but I am unable to see the other machines because this is a public network.

What I need to do is create a private network amongst my physical machine and the two virtual machines that reside within it. How can I do that?

I found how to make it think the public network a private network, but not how to create a private network that exists within the machine while still seeing the outside world.

My Google-fu hasn't revealed much - maybe I am using the wrong terms.

UPDATE: I added an additional NIC to both VM's and set them to local. I then started the VMs and tried to create a new network. However I can now see other machines on the hotel network and presumably they can see me (not desired). Can anyone give a detailed explanation of how to set this up or a link to a site that does? I can't be the only person who wants a private internal network on their PC?!

UPDATE2: Found this that describes what I want to do. Will try tomorrow to see if it works - seems I was almost there.

UPDATE3: Seems it didn't work. Added bounty which will be awarded for anyone who can do a step by step guide for getting two virtual machines to communicate. Extra cudos for using MySQL & Apache on the VMs!

graham.reeds

Posted 2011-05-25T22:07:42.870

Reputation: 248

Answers

6

To have the VMs on a separate network that is private to your PC, use the Microsoft Loopback Adapter. The Microsoft Loopback adapter is a testing tool for a virtual network environment where network access is not available. It sets up a virtual network adapter that is private to your computer.

To install, see this : How to install a Loopback Adapter in Windows 7.

After it is installed, from within Virtual PC :

  1. Select your virtual machine
  2. Go to the Settings
  3. Click the "Networking" setting
  4. For your network adapter, select "Microsoft Loopback Adapter"

Now, you should be able to see your other running Virtual PC instances that also share the same loopback adapter, while this virtual network is inaccessible from outside your computer.

If you need to use Internet from within the VMs, see this article :
Configuring NAT via using the Microsoft Loopback Adapter and Internet Connection Sharing.

harrymc

Posted 2011-05-25T22:07:42.870

Reputation: 306 093

This seems the most logical suggestion, I will try this first. – graham.reeds – 2011-06-02T22:49:34.843

Okay, now what? The both VMs are on Loop Back Adaptor but there is no network between the machines. Do I need to set a static IP address for them? – graham.reeds – 2011-06-02T23:20:47.897

Yes, as this virtual network doesn't have a DHCP server. Choose another network segment than that serviced by your router, for example 200.200.200.x rather than 192.168.x.x. – harrymc – 2011-06-03T09:18:50.213

Still not got it working. I assigned the 1st VM 192.168.200.1 and the second VM 192.168.200.2. That didn't work so I also assigned the host to 192.168.200.100. That didn't work. I also disabled ipv6 in case that confused the issue. Still no joy. Imagine, for an instant, I am really really dumb. Explain in simple steps how this should work and how to go about it. – graham.reeds – 2011-06-05T22:20:13.280

Before you ask "What errors did I get" - by not working I mean I can't ping the other VM. – graham.reeds – 2011-06-05T22:22:53.720

Perhaps this article will help. See also the troubleshooting advice by the end of this other article.

– harrymc – 2011-06-06T06:31:15.060

Seemed good right up til step 4. Soon as I did that the Host wanted to change the static ip from 192.168.200.100 to 192.168.137.1. I've allowed it for now - need to reconfigure the VM to use 192.168.137.x now. Will do that later when I get back from work. – graham.reeds – 2011-06-06T07:32:52.987

Do you mean that the host & VMs can see each other now ? – harrymc – 2011-06-06T07:43:38.793

Once I had disabled the firewall, which I am not too happy about. – graham.reeds – 2011-06-06T08:36:16.933

The firewall probably doesn't like the new network, but it is parametrable (do that after everything works correctly). – harrymc – 2011-06-06T08:54:01.700

So why did the host want to reconfigure the network from the number I had set it to to something different? It is not the same as the hotel network as that is 192.168.254.x. – graham.reeds – 2011-06-06T09:16:23.373

Was it ICS ? It has this habit. Better to go along with it. – harrymc – 2011-06-06T10:05:23.407

So change my network from 192.168.200.x to 192.168.137.x? Will do. – graham.reeds – 2011-06-06T11:27:41.157

Yes, on the Loopback Adapter. – harrymc – 2011-06-06T11:32:17.770

Okay, I can ping each other and I can ping google.co.uk (.com failed to find but that is due to geolocation redirection I think). I can also ping the name of the machines. – graham.reeds – 2011-06-07T09:47:20.110

Then mission accomplished. – harrymc – 2011-06-07T10:24:51.223

Still need to get the firewalls turned back on. A job for tonight. – graham.reeds – 2011-06-07T12:37:27.257

Well, in the rush to set up the firewall you forgot to accept the answer and assign the bounty. – harrymc – 2011-06-08T18:28:22.603

Well I thought that you accepted the best answer after the completion date and that would assign it. Doesn't seem much point in accepting early in the bounty phase in case a better answer came along later that was more complete. Sorry about that. – graham.reeds – 2011-06-09T11:08:03.583

Just checked the FAQ and it is perfectly clear. Once again my apologies. Can moderators change this? – graham.reeds – 2011-06-09T11:10:47.077

It's too late now, so half of your reps went up in smoke. I have been trying without success to convince the developers that this behavior needs changing. It could have been worse : without at least 2 votes your entire reps would have been lost. – harrymc – 2011-06-09T12:58:02.237

I agree. A decent way would be at the end of the bounty time a grace period of 3 days to allocate the bounty. Then that would allow me (who wasn't online last night due to the hotel internet connection disappearing) to allocate the bounty. – graham.reeds – 2011-06-09T13:29:31.567

You could always float your suggestion on Meta Super User. With enough upvotes it will be accepted and implemented. Drop me a comment if you do.

– harrymc – 2011-06-09T13:38:57.363

1

What VM product are you using? VMware? VirtualBox? MS Virtual PC? Most of them use NAT by default, which is what you would want if you desire to have those VMs be able to reach the internet.

Also how are you checking that these machines are "visible" to the public network? The host machine will be able to see the VMs because whether you use host-only, NAT, or bridged mode, your host Windows 7 will be able to see them. Only bridged mode should make the VMs visible to the public network. NAT mode makes your host PC act like a NAT router, so only your main host machine would actually be visible, but if you look at the network on the host machine, the VMs will still be visible because your host will be browsing both the public side AND the internal VM network.

So, to really see if those machines ARE ACTUALLY visible to the public network, you would need to use a device other than the host PC to try to look at them from the outside.

Lara Dougan

Posted 2011-05-25T22:07:42.870

Reputation: 2 266

I am using VirtualPC - hence why it is tagged with VirtualPC. Maybe I should of made that more explicit in my post. If I disconnect the host from the network and look at the network (under computer) nothing appears. If I connect to the hotel network and do the same again I can see the VM's (as well as several other machines). Also the VM's non-static IP addresses are in the same range as my physical machine. – graham.reeds – 2011-06-02T08:33:57.220

What version of Virtual PC? The networking options differ depending on what version used. Are you using the latest? – Lara Dougan – 2011-06-02T15:54:31.620

I believe so. According to the help dialog it is 6.0.192.0 – graham.reeds – 2011-06-02T23:24:41.890

0

The Hotels Wifi may actively prevent LAN side machines from communicating with each other.

You may have to get the machines on the Internet and then use a software layer VPN network like Hamachi.

Edit:

You might be able to set one VM up with two NICs, the first being 'Shared NAT', and the second being 'Internal'. Then, on the second VM (etc.) set it's NIC to Internal.

Then in Windows on the VM with the two NICs, enable Internet Connection Sharing to share the 'Shared NAT' adapter with the Internal-only network.

Ƭᴇcʜιᴇ007

Posted 2011-05-25T22:07:42.870

Reputation: 103 763

2How can a hotel network stop me from creating a LAN on my own machine? Did you read my question? – graham.reeds – 2011-05-25T23:08:50.780

Sorry, by LAN-side I meant the hotel's network. The network local to the hotel, not the network local to your hotel room. :) – Ƭᴇcʜιᴇ007 – 2011-05-26T03:31:48.570

I don't want to communicate with any other machines on the hotel network. I just want the machines internal to my machine to communicate with each other. I will try what your edit suggests tonight. – graham.reeds – 2011-05-26T09:06:17.783

Nope. I haven't got it working. I will do an update to my question. – graham.reeds – 2011-05-26T22:07:25.703

No matter what, if you want the VMs to communicate with the outside world, then they will need to communicate with at least one additional host on the hotel's network. – Kirk – 2011-06-08T01:51:07.207

0

Just make sure each machine on the same subnet.

Example:

192.168.50.0 w/ 255.255.255.0 as the netmask, or its referred to as a /24.
That gives you the addresses: 192.168.50.1 - 192.168.50.254 on the same network.
You could then give:
ComputerA - 192.168.50.10
ComputerB - 192.168.50.11
ComputerC - 192.168.50.12

Since they are on the same subnet they should talk and play nice.

daalbert

Posted 2011-05-25T22:07:42.870

Reputation: 311

0

It's been years since I've used Virtual PC, so it is possible that what I am going to suggest cannot be done. In other virtualization solutions, I would set up each VM so that I was able to get to the Internet (probably using a NAT connection). Once I was sure that the internet was working, I would add a 2nd NIC on a host only network, and set up static routing inside the client machines. The host only network would be for intra-client traffic, and the default route would be for everything else.

Kirk

Posted 2011-05-25T22:07:42.870

Reputation: 2 182