Mar 21, 2013

Using Virtualbox images with Hyper-V

In 2008 i wrote about using vmware images with virtualbox. To migrate a host from virutalbox to Hyper-V, you have to do nearly the same, but you have to convert the hdd:
C:\Users\schroff>"\Program Files\Oracle\VirtualBox\VBoxManage.exe" clonehd
"c:\Users\schroff\VirtualBox VMs\Debian64-DS\Debian64-DS.vdi"
"c:\Users\schroff\VirtualBox VMs\Debian64-DS-Hyper-V"\Debian-DS.vhd
-format vhd
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone hard disk created in format 'vhd'. UUID: c42129a8-c145-4a50-908c-023c8ed2b711

Hyper-V: Compile Linux Kernel with Microsoft device drivers

After knowing, that running a linux inside Hyper-V is only working with the "legacy" network adapter (look here), i was trying to build a kernel with the drivers (Microsoft has added the drivers into the Linux kernel versions >2.6.32).
There is one nice tutorial out there:
  • IT FROM ALL ANGLES: Hyper-V Guests: Compile Linux Kernel 2.6.32 on Debian 
But the menus of menuconfig have changed with kernel version 3.0. Microsofts Hyper-V kernel modules are no longer located inside the staging section. They can be found here:
Device Drivers --> Network device support -->
Device Drivers -->  Microsoft Hyper-V guest support -->
Device Drivers --> HID Support --> Special HID Drivers -->


All other steps work like described in IT FROM ALL ANGLES: Hyper-V Guests: Compile Linux Kernel 2.6.32 on Debian.
Microsoft offers a ISO-image for installing the kernel modules for some special kernel version for this linux distributions:
  • Red Hat Enterprise Linux 5.7, 5.8, 6.0-6.3 x86 and x64
  • CentOS 5.7, 5.8, 6.0-6.3 x86 and x64

The ISO-image can be downloaded from this location.

Note: If you try to build the kernel in you virtual machine, you need at least 6GB in /usr/src for compiling your kernel...

Mar 17, 2013

Hyper-V: Installing a debian linux in a virtual machine - trouble with the (non legacy) network adapter

First try with a virtualization solution like Hyper-V is to install a guest. So let's try debian linux.
The installer runs through this points:
  1. Name & path of the virtual machine
  2. RAM
  3. Network (how to configure a virtual switch with internet connectivity or how to configure internet connectivity with NAT)
    at this point you have to choose no connection (i will explain this later)
  4. Create a hdd
  5. The summary should look like this:
Next step you have to open the configuration of this virtual machine. There you can see a network adapter with the following properties:
Bandwith management? This sounds really good. There are two types of network adapters:

  • A network adapter requires a virtual machine driver in order to work, but offers better performance. This driver is included with some newer versions of Windows. On all other supported operating systems, install integration services in the guest operating system to install the virtual machine driver. For instructions, see Install a Guest Operating System. For more information about which operating systems are supported and which of those require you to install integration services, see About Virtual Machines and Guest Operating Systems (http://go.microsoft.com/fwlink/?LinkID=128037).
  • A legacy network adapter works without installing a virtual machine driver. The legacy network adapter emulates a physical network adapter, multiport DEC 21140 10/100TX 100 MB. A legacy network adapter also supports network-based installations because it includes the ability to boot to the Pre-Execution Environment (PXE boot). However, the legacy network adapter is not supported in the 64-bit edition of Windows Server 2003. 
  • And now think about, for which type of network adapter the standard kernel has a kernel modul (or you can get sources for)... Right. Only the legacy adapter.
    So you have to delete the network adapter and add a legacy network adapter. After this step, your virtual machine should look like:
    The bandwidth management is gone, but your kernel can use the tulip module and your network is working... Here you have to choose a virtual switch, which you can create like described in these two postings:  how to configure a virtual switch with internet connectivity or how to configure internet connectivity with NAT.

    It is not really suprising, that Microsoft adds as default to each new virtual machine a network adapter, which only works on a few linux distributions. You can download drivers from microsoft via this page (scroll down to "integration services"). But to add the default each for every new virtual machine, so that you have to delete this one and add the "legacy" adapter.

    But after knowing this, it is no problem to install debian linux (or any other linux) onto your Hyper-V.

    Hyper-V: Howto configure NAT for virtual machines

    In my last posting i explained how to configure a vEthernet adapter to get connectivity to the internet. But there was one "problem": You had to provide one seperate IP for each virtual host, you want to connect to the internet.
    But there is a solution (NAT) for this problem and it is easy to configure this with Hyper-V on Windows:
    [If you have not configured the "brigde"-solution i explained the last posting, then skip step 1 and start with step number 2]
    1. Unbridge your VSwitchExternal from Wifi
      (select both adapter in network adapters and do a right click an use "remove bridge")
    2. Create a new internal virtual switch via Hyper-V's virtual switch manager (look here, how to do this) and name it VSwitchNAT
    3. Edit properties of your Wifi adapter
      (right click and then properties)
    4. Open the tab "Sharing" and enable both Checkboxes.
      Choose "VSwitchNAT" for Home networking connection
    And after that your virtual machines are using a private subnet which will be NATted by your laptop. This private subnet can be configured via VSwitchNAT:
    • Edit properties of VSwitchNAT vEthernet adpater
    • Edit properties of ipv4 and here you can edit the subnet

    Mar 16, 2013

    Hyper-V on Windows 8: External virtual switches do not work - Howto connect a virtual host to the internet

    First thing you have to do after enabling Hyper-V is to set up your network for your virtual machines. This is not so easy, because some things do not work...
    So let's start: Open the Virtual Switch Manager
    There you have three options:

    1. external (connectivity to the internet)
    2. internal (connectivity between virtual machines on this Hyper-V and the host)
    3. private (only connectivity between virtual machines on this Hyper-V)
    Sounds like 1 is the option, which should be used, but this option does not work (you can find many postings via google, from guys, which chose this option and did not get any connectivity to anywhere...). On my laptop i was not able to get connectivity from the virtual host to the internet. Even worse: After configuring an external virtual switch my Windows 8 had no connectivity to the internet, too.
    But there is a workaround:
    1. Create a internal virtual switch and call it "VSwitchExternal"
    2. Open network adapters (via control panel->network) and select your network adapter (Wifi) and the new vEthernet adapter (via CRTL and click them):
    3. Now do a right click and choose "add to network brigde"
    Now this vEthernet adapter VSwitchExternal will work and your laptop is still connected to the internet.
    But you should be aware, that the virtual machine now needs its own ip on your external network. How to configure NAT for your virtual machine, so that you use the same address like your laptop, is explained in  this posting.

    Mar 15, 2013

    Windows 8: Enabling Microsofts Hyper-V virtualization platform

    If you are running a Microsoft Windows 8 Professional, you can use Microsofts virtualization platform Hyper-V. To get the management window you have to open
    C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Hyper-V Management Tools
    and double click the icon:
    If this icon (or the path) is not there, you have to enable Hyper-V:
    Open your control panel and choose programs & features:
    Then on the left side choose: activate Windows-features.
    The following dialog should appear:
    Choose Hyper-V
    Ok - now some reboots and then the Hyper-V manager should be there and you can also start it via dosshell:
    %windir%\system32\mmc.exe "%windir%\system32\virtmgmt.msc"
    And you will get: