Install and configure Microsoft Hyper-V Server 2008 R2

    Introduction


    Today I will tell you how to install and configure the Microsoft hypervisor, as well as how to manage it.
    So, first a little digression.
    As the existing infrastructure has been optimized, the question of virtualization has arisen. I immediately remembered the wonderful solution from VMware - ESXi, which I had worked with more than once and was more than satisfied and was about to migrate to it, but fate decreed otherwise. In the process of planning and choosing a virtualization platform, Hyper-V unexpectedly defeated.
    Two things tipped the scales in his direction: excellent support for hardware, as well as the fact that my organization uses only Microsoft products, as a result of which we have closer integration and better manageability. Unfortunately, AD support was announced in ESXi 4.1 later than the start of migration, otherwise I would probably think.
    As many people know, Hyper-V Server 2008 R2 is a free product and is a Windows Server 2008 R2 Standard operating system operating in Server Core mode (that is, without a GUI) and with the Hyper-V role enabled. In this regard, there are some difficulties in configuring the system for “Windows” admins, since there are no magic buttons “next” and “ready”, and even for Linux and even more so - the command syntax in Windows didn’t lie next to the nixes for convenience and understandability .

    Installation


    Let's start with the installation.
    Installing from a CD-ROM is not a big deal - booting from a CD, choosing a language, agreeing to the license agreement, choosing a partition and “quit smoking” for 10 minutes.
    image


    Customization


    Now the fun begins - the setup.
    At the first login, we see a text menu that allows you to perform initial server configuration.
    image
    In my opinion, it is not very convenient, in addition, by default you will not be able to remotely connect to the server using the Hyper-V Manager, so boldly close it and go to the command line.
    1. Setting an administrator password,
    run the command net user administrator *and enter a new password
    2. Network settings
    By default, network adapters are configured to receive an address via DHCP, if this suits you, you can go directly to step 3.
    Run the command netsh interface ipv4 show interface, remember the IDx of the desired network card.
    Run the command netsh interface ipv4 set address name=‘2’ source=static address=192.168.0.2 mask=255.255.255.0 gateway=192.168.0.1where 2 is the same IDx.
    To configure the dns servers, follow: netsh interface ipv4 add dnsserver name=‘2’ address=192.168.0.10
    You can always return the native settings with command netsh interface ipv4 set address name=‘2’ source=dhcp
    3. Computer name and input to the domain
    In principle, the domain is not necessary, but it greatly simplifies life, later I will tell you why. We assume that there is a domain and we will use this achievement of human thought.
    We look at the computer name with the command hostname
    Change the computer name with the command netdom renamecomputer WIN-KMTUYKKZPJQ /newname:vm1, where WIN-KMTUYKKZPJQ is the old name of your computer, and vm1 is the new one.
    We netdom join vm1 /domain:contoso.com /userd:administrator /password:*enter the computer into the domain with the command and enter the password of the specified account.
    Reboot.
    This completes the initial setup.

    Control


    To manage the server, you need to download and install Remote Server Administration Tools (RSAT) for the client operating system and install the Hyper-V Manager component, or add the Hyper-V role and install the Hyper-V Manager component on Windows Server 2008 R2.
    We are trying to connect to our server and we see an error that tells us to bring the beer admin to issue the necessary rights. Remembering that we are the same admin, do not lose heart and read on.
    John Howard, who holds the position of Senior Program Manager in the Hyper-V team at Microsoft, wrote a series of articles devoted to the distribution of necessary rights, and subsequently concocted the wonderful utility HVRemote , which will make ingenious server and client configuration without blowing the brain of the admin.
    We will use it. So, download , go to the server by \\ server \ C $ , put HVremote.wsf in the Windows folder (or in any other place, but then do not forget to specify the full path to it). Run on the server:,
    cscript hvremote.wsf /add:domain\account ***where domain \ account is your username in the domain. The script will register all the necessary privileges, including opening the necessary ports on the firewall.
    Then, on the cscript client hvremote.wsf / mmc: enable, the script will create firewall exceptions.
    Now you can launch Hyper-V Manager and connect to our server, create virtual machines and enjoy life.
    image

    Conclusion


    I’ll tell you about some points that I had to face:
    1. Use the English version of Hyper-V - the script will not work in the Russian language, since the names of the groups in the firewall will differ. From the client, the hyper-v interface will still be Russian.
    2. Use a domain. If there is no domain, you will need to perform the following steps:
    • Create an account on the server and on the client using net user
    • Give this user access cscript hvremote.wsf /add:accountname ***
    • On the client, allow anonymous access to DCOM cscript hvremote.wsf /anondcom:grant, log in with the same account that was allowed access on the server, or launch Hyper Manager -V from under the desired account, register the credentials for connecting to the server with the command cmdkey /add:servername /user:servername\account /pass, and create firewall exceptions with the commandcscript hvremote.wsf /mmc:enable
    That's all. If you have questions, I will answer with pleasure.
    PS: The author is my friend CLaiN.

    Also popular now: