How to PXE Boot Virtual Machine Hyper-V
PXE booting is a standard method to install operating systems and other software on virtual machines in a networked environment. It involves booting the VM from an image file hosted on another server instead of its local disk. Hyper-V is one popular virtualization platform supported by Microsoft that enables this process. In this article, we’ll show you how to PXE boot a virtual machine using Hyper-V.
Step 1: Setup Your Network
Before you can PXE boot a virtual machine in Hyper-V, it is necessary to configure its network settings. First, ensure the virtual machine is connected to an accessible virtual switch connected to the host network of the PXE server. Here are the steps for configuring this network:
- To configure a virtual machine in Hyper-V Manager, open the menu and select your virtual machine.
- To access these settings, select “Settings” in the right pane.
- Select “Network Adapter” from the list of available hardware items.
- Select “External” as your virtual switch type.
- Click “Apply” and then “OK” to save your changes.
Step 2: Configure the BIOS Settings
This step must be done to install a laptop or desktop computer.
Once your network settings have been configured, it’s time to configure the BIOS settings of your virtual machine to enable PXE booting. Here are the steps:
- Launch the virtual machine.
- Once the virtual machine starts up, press the appropriate key to access its BIOS settings. Depending on which virtual machine and version of BIOS you have installed, this may be “Delete,” “F2,” or “F10.”
- Navigate to the “Boot” tab in BIOS settings.
- Change the boot order, so your network adapter is the first device selected during Boot up.
- Save the changes and exit out of BIOS settings.
Step 3: Configuring the PXE Server
- Once your network and BIOS settings have been configured, it’s time to configure the PXE server to serve the image file to your virtual machine. Here are the steps for configuring this server:
- Install a PXE server on the network where your virtual machine is connected. There are various open-source and commercial options, such as FOG Project, Serva, and Microsoft Deployment Toolkit.
- Configure the PXE server to serve an image file for the operating system you wish to deploy. Ensure the image file is in a format compatible with the PXE server, such as WIM or ISO.
- Make sure the network settings for the PXE server are appropriately configured. It should be on the same subnet as the virtual machine and be able to communicate with it.
Step 4: Power On the Virtual Machine
Finally, we will proceed to PXE boot the Virtual Machine.
- Once the network, BIOS, and PXE server settings have been configured correctly, you can PXE boot your virtual machine. Here’s how:
- Launch the virtual machine.
- The virtual machine should automatically recognize and launch the PXE boot process.
- Follow the on-screen instructions to finish installing your operating system or software.
- Once installation is complete, modify the boot order in the virtual machine’s BIOS settings to boot from the local disk instead of the network adapter.
What is PXE Boot Hyper-V Gen 2
Hyper-V is a popular virtualization platform from Microsoft that supports PXE booting. Hyper-V Gen 2 virtual machines, available in Windows Server 2012 R2 and later versions, provide several advantages over Gen 1 virtual machines, such as faster boot times, support for Secure Boot, and larger virtual disks.
PXE booting on Hyper-V Gen 2 virtual machines involves configuring the network, BIOS, and PXE server settings, similar to what was done for PXE booting on Gen 1 virtual machines. However, there are some distinct differences in this process and requirements when performing PXE booting on Gen 2 virtual machines.
To enable PXE booting a Gen 2 virtual machine in Hyper-V, you must ensure the machine is configured with a Generation 2 virtual machine type. You can do this during creation or by converting an existing Gen 1 virtual machine to Gen 2 using the Convert-VMGeneration PowerShell cmdlet.
Once configured as a Gen 2 virtual machine, you can configure its network, BIOS, and PXE server settings the same way you would for a Gen 1 virtual machine. However, for PXE booting to work correctly on this virtual machine, you may need to use an older network adapter type, such as a “Legacy Network Adapter.”
Additionally, the image file served by the PXE server should be in a format compatible with Gen 2 virtual machines, such as VHDX. Finally, you may need to disable Secure Boot in the virtual machine’s BIOS settings to allow network booting.
How do I enable PXE on Windows 11?
Enabling PXE (Preboot Execution Environment) on Windows 11 involves configuring the network adapter settings and installing the necessary software components. Follow the steps below to enable PXE on Windows 11:
Configure the network adapter:
- Right-click the Start button and select “Device Manager.”
- Expand the “Network adapters” category and select the network adapter you want to use for PXE booting.
- Right-click the network adapter and select “Properties.”
- Select the “Advanced” tab and look for a setting called “Boot ROM” or “PXE Boot” (the exact name may vary depending on your network adapter).
- Set the “Boot ROM” or “PXE Boot” setting to “Enabled” or “On.”
- Click “OK” to save the changes.
Install the Windows Deployment Services (WDS) role:
- Open the “Server Manager” tool from the Start menu.
- Click “Add roles and features.”
- Click “Next” on the first screen and select “Role-based or feature-based installation” on the second screen. Click “Next.”
- Select the server you want to install the WDS role (usually the local server) and click “Next.”
- Select the “Windows Deployment Services” role and click “Next.”
- Click “Next” on the “Features” screen and then click “Install” to begin the installation process.
Configure the WDS server:
- Open the “Windows Deployment Services” console from the Start menu.
- Right-click the WDS server and select “Configure Server.”
- Follow the on-screen instructions to configure the WDS server. You must specify the location of the boot images and the network boot program.
- Once the WDS server is configured, you can add boot images by right-clicking the server and selecting “Add Boot Image.”
Configure the client’s computer:
- Boot the client computer and enter the BIOS or UEFI firmware setup.
- Configure the network boot settings to enable PXE booting and set the network boot as the first boot option.
- Save the changes and exit the BIOS or UEFI firmware setup.
- The client computer will now attempt to boot from the network and retrieve the boot image from the WDS server.
Can You Boot with UEFI?
It is possible to PXE Boot using the Unified Extensible Firmware Interface (UEFI). UEFI is a modern firmware interface that replaces the traditional BIOS (Basic Input/Output System) on modern computers.
UEFI supports PXE booting, but the process differs from traditional BIOS-based PXE booting. To take advantage of UEFI PXE booting with UEFI, your network adapter must support it. And your network environment must be configured accordingly.
To enable PXE boot with UEFI, you will need to configure the following:
UEFI Network Stack: This driver loaded during bootup provides network access for applications running under UEFI. Additionally, this stack must support PXE booting for full functionality.
UEFI boot loader – This application loads from the PXE server and starts the boot process. It must support UEFI-based systems and be compatible with the deployed operating system.
UEFI firmware settings: Enable PXE booting and select network boot as the initial boot option in your firmware settings.
Once these settings are configured, the UEFI-based system will attempt to connect to the PXE server and retrieve its bootloader through the UEFI network stack. Once loaded, this boot loader will begin installing or deploying your operating system.
It is essential to know that PXE booting with UEFI requires additional configuration and may not be supported by all network adapters or PXE servers. For more specific instructions and requirements for PXE booting with UEFI, it is best to consult the documentation from your hardware and software vendors.
How do I start PXE over IPv4?
Starting PXE (Preboot Execution Environment) over IPv4 involves configuring the network boot settings on the client computer and ensuring that the PXE server is available on the network. Follow the steps below to start PXE over IPv4:
Configure the network boot settings:
- Boot the client computer and enter the BIOS or UEFI firmware setup.
- Navigate to the “Boot” or “Boot Options” section and look for an option called “Network Boot” or “PXE Boot” (the exact name may vary depending on your computer’s firmware).
- Enable the “Network Boot” or “PXE Boot” option and set the network boot as the first boot option.
- Save the changes and exit the BIOS or UEFI firmware setup.
Connect the client computer to the network:
- Ensure that the client computer is connected to the network via Ethernet cable or wireless connection.
- Verify that the network adapter on the client computer is functional and has an IP address assigned.
Ensure that the PXE server is available on the network:
- Verify that the PXE server is connected to the same network as the client computer.
- Ensure that the PXE server is powered on and configured correctly.
- Verify that the PXE server has an IP address assigned and is reachable from the client computer.
Boot the client computer:
- Power on the client computer or restart it if it is already on.
- The client computer will attempt to boot from the network and retrieve the boot image from the PXE server.
- The boot image will contain the necessary files and software to install or deploy the operating system or other software.
How do I disable the PXE boot virtual machine?
Disabling PXE (Preboot Execution Environment) boot for a virtual machine in Hyper-V involves modifying the boot order settings. Follow the steps below to disable PXE boot for a virtual machine:
- Open Hyper-V Manager:a. Open the Hyper-V Manager tool from the Start menu or using the Run dialog box (press Windows + R and type virtmgmt.msc).
- Select the virtual machine:a. Locate and select the virtual machine for which you want to disable PXE boot.
- Modify the boot order settings:a. Right-click the virtual machine and select “Settings”.
b. Select the “Security” or “Boot Order” section, depending on the version of Hyper-V you are using.
c. Locate the network adapter that you want to disable PXE boot for.
d. Click the arrow button to move the network adapter down the boot order list, so that it is not the first boot option.
e. Click “Apply” and then “OK” to save the changes.
- Verify the boot order settings:a. Power on the virtual machine or restart it if it is already on.
b. Verify that the virtual machine boots from the correct device, such as the virtual hard disk or ISO image.
c. If the virtual machine still tries to boot from the network, repeat the steps above to modify the boot order settings.
Can you PXE boot a virtual machine?
Yes, it is possible to PXE (Preboot Execution Environment) boot a virtual machine. PXE boot is a network boot method that allows a computer or virtual machine to boot and deploy operating systems or other software over the network. Follow the steps below to PXE boot a virtual machine in Hyper-V:
- Configure the virtual machine:a. Create a new virtual machine or select an existing one that you want to PXE boot.
b. Add a network adapter to the virtual machine if it does not already have one.
c. Connect the network adapter to a virtual switch that is configured for PXE boot.
- Modify the boot order settings:a. Right-click the virtual machine and select “Settings”.
b. Select the “Security” or “Boot Order” section, depending on the version of Hyper-V you are using.
c. Move the network adapter to the top of the boot order list, so that it is the first boot option.
d. Click “Apply” and then “OK” to save the changes.
- Verify the PXE boot process:a. Power on the virtual machine or restart it if it is already on.
b. The virtual machine will attempt to boot from the network and retrieve the boot image from the PXE server.
c. The boot image will contain the necessary files and software to install or deploy the operating system or other software.
How do I change the boot sequence in Hyper-V virtual machine?
Changing the boot sequence in a virtual machine running on Hyper-V is a straightforward process. The steps to change the boot sequence are as follows:
- Open Hyper-V Manager:a. Open the Hyper-V Manager tool from the Start menu or using the Run dialog box (press Windows + R and type virtmgmt.msc).
- Select the virtual machine:a. Locate and select the virtual machine for which you want to change the boot sequence.
- Modify the boot order settings:a. Right-click the virtual machine and select “Settings”.
b. Select the “Security” or “Boot Order” section, depending on the version of Hyper-V you are using.
c. Arrange the boot order by clicking on the boot device and moving it up or down in the list.
d. The boot order should reflect the desired boot sequence.
e. If you wish to remove a device from the boot order, select it and click the “Remove” button.
f. If you want to add a new device, click the “Add” button and select the device you want to add.
- Save the changes:a. Click “Apply” and then “OK” to save the changes.
- Verify the boot order settings:a. Power on the virtual machine or restart it if it is already on.
b. Verify that the virtual machine boots from the correct device, such as the virtual hard disk or ISO image.
How do I boot from Hyper-V VM to BIOS?
To access the BIOS settings of a Hyper-V virtual machine, follow these steps:
- Start the Hyper-V Manager by searching for it in the Start menu or using the Windows key + X shortcut and selecting “Hyper-V Manager” from the menu.
- Select the virtual machine you want to access the BIOS settings for and click on “Connect” in the right-hand panel.
- A virtual machine window will appear. Click on the “Start” button to begin booting the virtual machine.
- While the virtual machine is booting, press the designated key to enter the BIOS settings. This key is typically displayed during the boot process and may be different depending on your virtual machine’s configuration. Common keys include F2, F10, Del, or Esc.
- Once you have successfully entered the BIOS settings, you can configure the virtual machine’s hardware settings as needed.
- When finished, save the changes and exit the BIOS. The virtual machine will continue to boot normally.
Conclusion:
PXE booting is an efficient and robust method for quickly installing operating systems and software on virtual machines in a networked environment. Hyper-V has built-in support for PXE booting, making it simple to set up and utilize. By following the steps outlined in this article, you can successfully PXE boot a virtual machine in Hyper-V and quickly deploy software applications.