Share This Post

Using a Laptop with Hyper-V for Portable Labs

I want to be able to take my lab environments with me everywhere I go so I got a new laptop that is powerful enough to run an entire System Center 2012 lab and a couple other labs at the same time. I then installed Server 2008 R2 with Hyper-v as the base OS.

Below I will detail the steps required to gain Internet access via WiFi to Hyper-V hosted labs, while maintaining segregation between the labs and physical networks.

I quickly found that configuring the network connections, to meet my requirements, in Hyper-V over WiFi wasn’t so cut and dry nor was it documented well in one easy to read location.

I require the ability to run multiple, heterogeneous labs on a single laptop. These lab environments must be completely unaware of both one another as well as the physical network. The second big challenge is that I need all the computers in each lab to have Internet access. Each lab will have a domain controller, several member servers and a couple of clients.

I’d suggest that you first go through one or both of these two blogs which describe how to enable Server 2008 to be a workstation.

http://www.win2008workstation.com/

http://blogs.msdn.com/b/vijaysk/archive/2008/02/11/using-windows-server-2008-as-a-super-desktop-os.aspx

After you have the desktop experience installed and any customizations you’d like from the links above it’s time to enable Hyper-V and setup the required networking features within the host and guest operating systems. I disable the firewall and IE ESC before proceeding but that was covered in the blogs I linked to. If you followed the steps in the links above you should have already installed the wireless LAN service feature. If you have not already done so go ahead and enable wireless LAN service and install the Hyper-V role. There’s nothing special to do here, just run through the install roles wizard and select Hyper-V.

As I mentioned earlier my requirements may differ from yours. My goal is to run multiple labs on the same physical host. Those labs computers should not be aware of one another nor should they be aware of the physical network. However all lab computers must have Internet access. What I am about to describe works for this scenario. If your requirements differ this may not work for you.

1. Go to Hyper-V manager, open virtual network manager and add an internal virtual network. I called mine Internal VM Wifi and click OK.

2. Next create a private virtual network in network manager. I name mine according to the lab that will use this network. Each of my labs will use its own private virtual network so I perform this step once for each lab I intend to install.

3. On the host machine, in the Network and Sharing Center click on Change Adapter Settings. I suggest renaming the newly added adapter to something meaningful. I call mine Internal VM Wifi rather than the default network adapter #3.

4. Select both your WiFi adapter and the internal VM Wifi adapters by doing ctrl + click on each. Right click and select Bridge Connections

No more settings are required on the host machine at this time.

Go back to Hyper-V manager and create a new virtual machine.

1. The first virtual machine that should be created is the domain controller. This is the only machine that will need to connect to both the private network as well as the Internal VM Wifi network.

2. When I did this for the first time I didn’t add both networks prior to installing the OS. I came back later and added them and then the servers would not boot. Having said that I advise that you add both networks during the initial creation of the virtual machine prior to installing the OS.

3. During the new Virtual Machine Wizard add the Internal VM Wifi at the Configure Networking phase

4. After the virtual machine has been created right click the virtual machine in Hyper-V Manager and select settings.

5. On the Add Hardware page add a network adapter, select the private network created earlier and click OK.

6. Install a server OS on this virtual machine. This will become the domain controller, DHCP and DNS server for the lab network. I am using Server 2008 R2 so that’s what the remainder of this document is written based upon.

Perform the following high level steps on the newly installed Server 2008 R2 virtual machine. I’m not going into detail here how to build a domain controller, if you need that info you are in the wrong place.

1. Disable the Windows Firewall and IE ESC.

2. Verify that you can get to the internet.

3. Run ipconfig and note that one of your network connections has an IP address and the other does not. Remember which is which.

4. Open Control Panel>Network and Internet>Network Connections. By default the two network connections will be named Local Area Connection and Local Area Connection 2. If you are unsure which has an IP and which does not from step 2 above you can view the status of the connections. One will have Internet Access and the other will not. Rename the connection that has Internet access and an IP Address to External Network Connection and the other to Internal Network Connection

5. Assign a static IP to the Internal Network Connection. This IP will later be excluded from the scope you will create in DHCP after the server becomes a domain controller. I use 192.168.2.100. This address will also be the default gateway and the DNS server address.

6. Install the Active Directory domain service role.

7. Run dcpromo.exe to start the Active Directory Domain Services Installation Wizard which will also install DNS. Don’t worry about the message saying one network card has no static IP address. This is by design. The External Network Connection will never have a static IP, only the Internal Network Connection should have one.

8. Complete the Active Directory Domain Services Installation Wizard and reboot the computer.

9. Install the DHCP Server and the Network Policy and Access Services roles. You should only select Routing and Remote Access Services for the Network Policy and Access Services role. You should automatically see the Internal Network Connection as the only option that can be used to service DHCP clients. This is because it’s the only one that has a statically assigned IP Address. Use the IP you assigned this server as the IP address clients will use for name resolution. Setup a starting and ending IP address. I use 192.168.2.150-192.168.2.175 which leaves room for more servers to have static IP’s later. Enter the IP address that you assigned to this server as the default gateway that will be handed out to clients. Complete the wizard.

10. Open the Routing and Remote access snap-in. Select your server, right click and Configure and Enable Routing and Remote Access, select NAT. On the screen “Use this public interface to connect to the internet” select your External Network Connection.

This should complete the setup of your networking components. Install a new virtual machine, connect it to the private virtual network, join it to your domain, let it use DHCP and check your Internet connectivity.

If you want this environment to be even more portable install the “host” OS on a VHD using boot from VHD. This way the entire lab is contained within a single VHD file that you can boot from any Windows 7 or Server 2008 R2 physical machine.

Share This Post

10 Comments

  1. Thanks for sharing this, a well-timed and useful post.

  2. Looks good, I’ll be doing something similar soon 🙂

  3. You’re going to make me convert my mobile command center into a hyper-v lab…..

  4. I’m kind of wishing now I’d gone ahead with server 2012 though.

  5. Having setup a couple of systems as described here over the years, looking at Server 2012 and Windows 8 has changed my thinking. One of the issues I had with running Server 2008 and Hyper-V was the lack of power management. I’d leave home with a full battery and by the time I get to town, I have a very warm laptop bag and the flashing orange (no power in your batteries!) light.

    I gave up trying to run Hyper-V on my laptop – for while I ran Virtual Box. That worked well enough for my needs – if nothing else, I gained back power management. But it’s not really the answer I wanted.

    With the release of Windows 8 RC, I’ve rebuilt my laptop to use this build and I am very happy. Particularly as it run Hyper-V and seems to have decent power management. I really like the PowerShell interface in Server 2012/Win8. You can pretty much fully automate the building and managing of VMs from the built-in PowerShell cmdlets.

    I know it’s pre-release software, and $Deity knows the Metro interface blows big chunks, I think Win 8 would be worth at least considering for your needs. From what I can tell after a month’s use – it works pretty well here!!

    HTH

    Thomas

  6. Just out of interest could any of you give me a brief run-down of your laptop specification? It’s all too easy to tick all the boxes on the options list but sadly my current finances dictate my proposed machine has to be built to quite a meagre budget.

  7. My specs are pretty high, I’m sure you could get away with less. I’m about to run an entire System Center 2012 lab on my laptop, not just CM, all the system center products running on seperate servers.

    Dell Precision M4600
    Intel Extreme I7 Quad Core
    128 GB SSD Mini-Card
    32 GB RAM
    750 GB 7200 RPM Hard Drive (considering changing this to 500 Gb SSD)

  8. I have setup the Hyper-V lab as posted, however, my clients with windows 7 or XP can’t get address from DHCP server even I have assigned static IP or changed the MAC from Dynamic to Static. Could you tell me why?

    Thanks

  9. Hi Folks, I was looking for a similar requirement, and found this post..
    I am looking at installing any 2008 server OS on my Dell Precision M4600.
    Dell tell me that, they do not have drivers for the server OS, hence not possible.
    I have tried, W2k8 server R2, almost all editions, Vmware, esx 4.1 to 5.1, Windows hypervisor server 2008 R2. All have failed.
    Has any one been successful?

    My specs are
    Ram – 16 GB
    Proc – i7
    Hdd- 500 GB
    Type – laptop

    If yes, would be great, if someone could tell me a workaround for this, and where can I get the drivers for the server OS..

    Regards
    Nag..

  10. The machine this blog was written on is an M4600. The drivers are no problem.

Leave a Reply