Wondering how to Boot a guest using PXE? We can 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.
Here at Bobcares, we handle guest servers of our customers as a part of our Server Management Services.
How 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>
Using 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 assistance? We can help you!]
Conclusion
In short, we saw the steps that our Support Techs follow to boot a guest using PXE.
0 Comments