Monday, January 28, 2013

Hyper-V Internal Virtual Network and Internet Access

For the uninitiated, Hyper-V is Microsoft's virtual machine software. It comes included with Windows 8 Pro, so I thought I would give it a spin and see how it compares with the alternatives I've been using for years: VMWare and VirtualBox. What I want to do is run an evaluation copy of Windows Server 2012 on my Windows 8 notebook such that:
  1. The virtual machine is on an internal, virtual network with its own subnet.
  2. It can still reach the Internet for updates and such.
For VirtualBox and VMWare (the desktop versions, anyway), this was easy: just set the virtual machine's networking to NAT mode and it will use the host machine as its Internet gateway while being (somewhat) segregated from the host machine's peers. I was surprised to find that Hyper-V lacks this option!

The Fix (Short Version)

Set up the virtual machine on an "Internal Virtual Network," then configure Internet Connection Sharing on the host machine.

Prerequisites

Enable Hyper-V. Then install a virtual machine, skipping anything to do with networking. The virtual machine will lack network adapters. Power off the virtual machine.

Create an Internal Virtual Switch

In Hyper-V Manager, click "Virtual Switch Manager" on the Actions pane on the right. Create a new "Internal" virtual switch here. You should give it a meaningful name (I used "Hyper-V Internal Switch"), but there's no need to change any other options.

This will add a virtual network adapter to the host machine (my Windows 8 notebook) so that the host and virtual machines can communicate with each other through standard networking protocols. Here's the current topology:

[LAN]
    |
[physical network adapter]-[host machine]-[virtual network adapter]
                                                                                     |
                                                                          [virtual switch]
                                                                                     |
                                           [virtual machine]-<nothing here yet>

And here is what the "virtual network adapter" looks like on my Windows 8 notebook's list of network connections:


Attach the Virtual Machine to the Virtual Switch

Select the virtual machine in Hyper-V Manager and click "Settings" on the Actions pane on the right. Select "Add Hardware" and add a "Network Adapter." Select the virtual switch you just created.  (You can re-use the same switch for other virtual machines later.) The remaining settings can be left at their defaults.


Now the topology is complete:

[LAN]
    |
[physical network adapter]-[host machine]-[virtual network adapter]
                                                                                     |
                                                                          [virtual switch]
                                                                                     |
                                           [virtual machine]-[network adapter]

At this point, the host and virtual machines are "wired" to each other, but they don't have IP addresses. Before fixing that, a brief detour.

Enable Routing and Remote Access

On the host machine (e.g. my Windows 8 notebook), open Services and change the "Routing and Remote Access" service from "Disabled" to "Automatic (Delayed Start)". Then click "Start."

Set Up Routing

Open Network Connections on the host machine and open the properties of your physical network adapter (for me, it's the Wi-Fi adapter). Then click the "Sharing" tab and check "Allow other network users to connect through this computer's Internet connection". For the "Home networking connection," select the virtual network adapter created above. Click OK and you'll see a warning like this:


The wording is a little misleading. When it says "your LAN adapter will be set to use IP address 192.168.137.1" it means—in this case—that the virtual adapter will use that address. Your physical adapter settings will stay the same. Confirm this by opening the virtual network adapter (pictured in the "Create an Internal Virtual Switch" section above), then scroll down on the "Networking" tab to "Internet Protocol Version 4 (TCP/IPv4)" and open its properties:


Now you know where to look if you forget this address or want to change it to something else. The important thing is that this address not be on the same subnet as the physical LAN.

Test Virtual Machine Networking

Boot up the virtual machine. Since the topology looks like this...

[LAN]
    |
[physical network adapter]-[host machine]-[virtual network adapter:192.168.137.1]
                                                                                     |
                                                                          [virtual switch]
                                                                                     |
                                           [virtual machine]-[network adapter:DHCP]

...and connection sharing automatically provides DHCP service to the virtual switch, the virtual machine should pick up an address in the .137 subnet (or whatever was assigned). For example, here's how my Windows Server 2012 virtual server's adapter looks:



It picked up 192.168.137.125 from DHCP and it's sending all Internet traffic to 192.168.137.1, which is the virtual network adapter on the host. From there, connection sharing on the host forwards traffic out the host's physical network adapter to the LAN's Internet gateway.

You can, of course, give virtual machines static network settings, so long as "Default Gateway" matches up with the virtual network adapter on the host. And now the test:


Yep, Google is still up (and my virtual machine can get there).

Thursday, January 24, 2013

Quote of the Day: Antelope as Document

"An antelope running wild on the plains of Africa should not be considered a document, she rules. But if it were to be captured, taken to a zoo and made an object of study, it has been made into a document. It has become physical evidence being used by those who study it. Not only that, but scholarly articles written about the antelope are secondary documents, since the antelope itself is the primary document."

— from What is a "Document"? by Michael Buckland

Tuesday, January 1, 2013

Monthly Picks

On the first day of each month, I will be posting about papers I've found interesting in Philosophy or Library & Information Science. I'll try to make sure at least one is accessible to everyone.

Campbell, D.G. (2011). RDA and RDF: A discourse analysis of two standards of resource description. Proceedings from North American Symposium on Knowledge Organization, 3, 207-16.
[link] freely accessible

Khanna, D.S. (November 16, 2012). RSC policy brief: Three myths about copyright law and where to start to fix it. The Republican Study Committee. Originally available at http://rsc.jordan.house.gov/
[link] freely accessible