×


Boot a guest using PXE - Do it now

Are you trying to Boot a guest using PXE?

This guide will help you.


The Preboot Execution Environment (PXE) is an industry-standard client/server interface. It allows to remotely boot networked computers that do not have an operating system configured yet.

PXE works with the Network Interface Card (NIC) of the system thus, making it function like a boot device.

Basically, You can start a virtual machine from a network device and remotely install a guest operating system using a Preboot Execution Environment (PXE). 

You do not need the operating system installation media. When you turn on the virtual machine, the virtual machine detects the PXE server.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to handle guest servers and perform Linux related tasks.


Steps to Boot a guest using PXE and bridged networking:

1. Firstly, we need to ensure bridging is enabled such that the PXE boot server is available on the network.

2. Then boot a guest virtual machine with PXE booting enabled.

For this we can use the virt-install command and create a new virtual machine with PXE booting enabled, as shown in the following command:

virt-install --pxe --network bridge=breth0 --prompt

Alternatively, we can ensure that the guest network is configured to use a bridged network and that the XML guest configuration file has a <boot dev=’network’/> element inside the <os> element, as shown in the following example:

<os>
<type arch='x86_64' machine='pc-i440fx-rhel7.0.0'>hvm</type>
<boot dev='network'/>
<boot dev='hd'/>
</os>
<interface type='bridge'>
<mac address='52:54:00:5a:ad:cb'/>
<source bridge='breth0'/>
<target dev='vnet0'/>
<alias name='net0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>


How to use a Private libvirt Network ?

To configure PXE booting on libvirt we can use the following steps:

1. Firstly, place the PXE boot images and configuration in /var/lib/tftpboot.

2. And enter the following commands:

# virsh net-destroy default
# virsh net-edit default

3. Then edit the <ip> element in the configuration file for the default network to include the appropriate address, network mask, DHCP address range and boot file, where BOOT_FILENAME represents the file name we are using to boot the guest virtual machine:

<ip address='192.168.122.1' netmask='255.255.255.0'>
<tftp root='/var/lib/tftpboot' />
<dhcp>
<range start='192.168.122.2' end='192.168.122.254' />
<bootp file='BOOT_FILENAME' />
</dhcp>
</ip>

4. After that run the following command:

# virsh net-start default

5. Now, we will boot the guest virtual machine using libvirt with PXE booting enabled. We can use the virt-install command to create/install a new virtual machine using PXE:

virt-install --pxe --network network=default --prompt

Alternatively, ensure that the guest network is configured to use private libvirt network and that the XML guest configuration file has a <boot dev=’network’/> element inside the <os> element, as shown in the following example:

<os>
<type arch='x86_64' machine='pc-i440fx-rhel7.0.0'>hvm</type>
<boot dev='network'/>
<boot dev='hd'/>
</os>

Also, we must make sure that the guest virtual machine is connected to the private network:

<interface type='network'>
<mac address='52:54:00:66:79:14'/>
<source network='default'/>
<target dev='vnet0'/>
<alias name='net0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>


[Need urgent assistance to fix Ubuntu errors? We can help you! ]


Conclusion

This article covers how to boot a guest using PXE. PXE booting is supported for Guest Operating Systems that are listed in the VMware Guest Operating System Compatibility list and whose operating system vendor supports PXE booting of the operating system.

The virtual machine must meet the following requirements:

1. Have a virtual disk without operating system software and with enough free disk space to store the intended system software.

2. Have a network adapter connected to the network where the PXE server resides.


A virtual machine is not complete until you install the guest operating system and VMware Tools. Installing a guest operating system in your virtual machine is essentially the same as installing it in a physical computer.


To use PXE with Virtual Machines:

You can start a virtual machine from a network device and remotely install a guest operating system using a Preboot Execution Environment (PXE). 

You do not need the operating system installation media. When you turn on the virtual machine, the virtual machine detects the PXE server.


To Install a Guest Operating System from Media:

You can install a guest operating system from a CD-ROM or from an ISO image. Installing from an ISO image is typically faster and more convenient than a CD-ROM installation. 


To Upload ISO Image Installation Media for a Guest Operating System:

You can upload an ISO image file to a datastore from your local computer. You can do this when a virtual machine, host, or cluster does not have access to a datastore or to a shared datastore that has the guest operating system installation media that you require.


How to Use a private libvirt network ?

1. Boot a guest virtual machine using libvirt with PXE booting enabled. You can use the virt-install command to create/install a new virtual machine using PXE:

virt-install --pxe --network network=default --prompt

2. Alternatively, ensure that the guest network is configured to use your private libvirt network, and that the XML guest configuration file has a <boot dev='network'/> element inside the <os> element, as shown in the following example:

<os>

   <type arch='x86_64' machine='pc-i440fx-rhel7.0.0'>hvm</type>

   <boot dev='network'/>

   <boot dev='hd'/>

</os>

3. Also ensure that the guest virtual machine is connected to the private network:

<interface type='network'>

   <mac address='52:54:00:66:79:14'/>

   <source network='default'/>

   <target dev='vnet0'/>

   <alias name='net0'/>

   <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>

</interface>