How to use qemu with pxe?

you can refer the wiki page official wiki for more details. This page contains my experiences.

qemu with tftp

boot qemu PXE with tftp protocol:
To make my life simple, I downloaded following files into directory /home/myname/pxe/

Then I modified the gtest.gpxe to use tftp instead of http.
Edited contents of my gtest.gpxe are as follows

kernel tftp:// root=100
initrd tftp://

Then I used qemu with bootp to boot with tftp in following way.

qemu -bootp tftp:// -tftp /home/myname/pxe/ -fda gpxe.dsk

The IP address used here can be anything, It's not the IP address of my machine. As long as you use the same IP address in qemu command and in gtest.gpxe file, it should work.

How it works?

Here I am not running any tftp server on my machine. qemu will do most of the work for us.

  1. Firstly, it will simulate the dhcpd server and return the IP address to the booting pxe.
  2. Next, It will simulate tftp server, with root directory at /home/myname/pxe/ and provides files from that location to the pxe.
  3. pxe assumes that it is talking to tftp server and its request for file

    will be mapped to /home/myname/pxe/gtest.gpxe file.

qemu with HTTP

For this test, all that you need to have is gpxe.dsk and following command should work without any problems.

qemu -fda gpxe.dsk -net nic -net user -bootp

I also created the copy of gtest on my own web server for testing purpose, and it worked with following command.

$ qemu -fda gpxe.dsk -net nic -net user -bootp

QR Code
QR Code wiki:qemupxe (generated for current page)