45 - How to PXE boot grub4dos or WinPE (from a Windows 7 PC) using tftpd

tumblr statistics
If you just want to install any Windows version via PXE and set up a PXE RIS & WDS server VERY EASILY - see Tutorial #76

Other Tutorials you might like:


If you have an Ethernet network and a hub or router, you can boot to a grub4dos menu directly over the Ethernet wire without needing any boot device or even a hard disk in the computer. Nearly every modern x86 (Wintel) Windows PC, notebook or netbook has a BIOS which supports PXE booting. Normally you just need to press a key just after switch-on (e.g. F12) to start the computer looking for a PXE boot server on the Ethernet network (or configure the boot order in the BIOS and enable the 'network boot/ROM' option in the BIOS setup menu first).

Once you have a PXE server working (which can be your Windows 7/Vista/XP main PC), you can then boot any other PC/netbook on the same Ethernet network even if there is no Operating System on the hard disk of the target/client PC. You don't even need a USB drive! For instance, you can boot to WinPE via PXE booting, connect via the network to a shared folder on another computer and run Windows 7 Setup to install Windows onto the target computer.

Note: Some LAN interfaces will allow a direct connection between computers with no need for a router - i.e. [PC] <---> [Notebook] and most will only require a normal Ethernet cable and not a special 'cross-over' cable. So you can just omit the router and connect your two systems together with just one Ethernet cable and see if it works (check you have a link light and see if tftpd32 is seeing PXE packet requests) - if it does not work then try connecting the router in and disabling DHCP as detailed in Step 2 below.

How PXE booting works
The case I am going to describe is for a simple home network (no server) which consists of a simple Ethernet network as shown below:

Windows PC <------> Dlink ADSL router + 4 port hub <-------> any other PXE-boot capable computer
(PXE & TFTP Server) (PXE client)

<------------------> <------------------>

This is a typical home network (though you may have more PCs on the wire or on WiFi). If you have a server, then the instructions below will need to be changed accordingly as your server will probably be acting as your DHCP server. If you have a more complex network setup, then make sure you have read and completely understand this tutorial first - you could 'break' your network and internet connectivity!
Let us assume I have a netbook (say an Asus EeePC) which I want to PXE boot over the network from my Windows 7 PC...

PXE booting works as follows (simplified!):

1. The netbook (the PXE client or 'target' PC) requests an IP address from a DHCP server which should be on the network somewhere
2. The DHCP server replies with an IP address that the netbook can use - it ALSO includes in the reply, the name of a boot file which is available and the IP address of a TFTP server.
3. Because the netbook is PXE booting, it now makes a TFTP request for this file using the IP address information in the last DHCP packet
4. A TFTP server receives the request for the boot file, gets the file data and starts to send it to the netbook in chunks
5. The netbook loads the boot file into memory and starts to execute the code in it when it has received all of it.

From the five steps above, you can see that we need to have both a DHCP server which can send this boot filename out and also a TFTP server which will respond to file requests.

In the typical home network shown above, the (Dlink) router will normally be acting as your DHCP server. This means that it will be assigning IP addresses to any computer that is connected to the network. However, most home routers are not capable of supporting PXE booting and so we must disable the DHCP service on the DLink router and replace it with a DHCP server of our own. We also need a TFTP server too. Luckily, there is a free open-source project called tftpd32 here which, when tftpd32 is running on your PC, will provide both DHCP and TFTP services (on any Windows computer).

The instructions below will disable the DHCP server which is running in the DLink router and configure the tftpd32 utility to be the DHCP server. This means that you must always run tftpd32\64 on your PC whilst DHCP on your router is disabled - otherwise any other PC on your network will not be able to properly connect to the network and the internet. When you have finished playing with PXE booting, it would be best to enable DHCP on your router again and quit the tftpd32 utility - otherwise you must remember to switch on your PC first and start tftpd32/64 first before the other computers on the network are switched on or connected to the network.

Tip: If you have a spare hub/router, then use that with a few spare Ethernet cables to save mucking about with your home network.


Lets get going!

  • First, print out this tutorial or save it to your Desktop as a file - if you lose internet connectivity you may be glad you did!
  • Next, make sure you backup your Windows system (type 'Create a Restore Point' in the Windows 7 Start menu box to run it).
  • Ensure you know your routers username & password and how to set up the ADSL credentials which were originally given to you by your ISP (e.g. BT or Virgin or TalkTalk or whoever) - if you have to reset your router, you will need to put these details in again!
  • Get a piece of paper and a pen to make a note of your current settings as you go along - no REALLY! Get some paper and a pen NOW! You haven't done it have you? Look, you may have a fantastic memory, but if you lose network connectivity and internet connectivity and can't get it working again, don't blame me just because you couldn't be bothered!
  • Lastly, save your current router settings to a file on your PC - no REALLY! I really mean it - do it now! Then try to re-load the saved settings file to make sure it works.
Note: many modern systems will work if you directly connect the two Ethernet ports (computer <--> computer) together using an ordinary Ethernet cable, without the need for a hub/router or cross-over Enet cable. If you are reluctant to change your router settings, simply unplug it and connect the cable straight to your target PXE-boot system. It may or may not work. If it does not work (check for a link light on the Ethernet port) then you will have to use a hub or router.

These instructions could potentially screw up your network and internet access. Changing Windows 7 network settings and then changing them back again is easy and works well. The main issue you may have is with the router when you enable or disable DHCP - so back up the router configuration (most routers have a 'save config to file' option)!

1. The first thing to do is note down your current settings. In Windows 7, go to Control Panel - Network and Sharing Center - Local Area Connection

Fig. 1 Network Control Panel

Fig. 2 Click on Details

Fig. 3 Record the IPv4 details
Make a note of the following (on that piece of paper that you have ready - right?):
IPv4 Address in my case - this is the IP address of the PC (given to it by the Dlink router)
IPv4 Default Gateway (my DLink router's IP address)
IPv4 DHCP Server (my DLink router is the DHCP server)
IPv4 DNS Server (my DLink router is the internet DNS server too)

Note that it says 'DHCP Enabled Yes' which means that it expects a DHCP server to be on the network (in this case my DLink router).

We now need to stop my Windows 7 PC from getting it's IP address from the DLink router via DHCP and set the IP address of the Windows 7 PC to a specific, fixed IP address, because we are going to run a DHCP server (tftpd32) on the PC itself.

Click Close and then click on the Properties (see Fig. 2) and select Internet Protocol Version 4 (TCP/IP v4) and click on Properties.
Now set it up as shown below as we want to fix the PC's IP address as it will become our DHCP server.

Fix the IP address to be the same as it was before.
Also set the DNS server IP address to the DLink router's address
as that will still be our internet server.
The Default Gateway is also the Dlink internet router.

2. Now go to your router and stop it from being a DHCP server. IMPORTANT: Use Internet Explorer as the browser - some router web interfaces do not work fully with other browsers - e.g. Chrome! In my case this meant typing the DLink router's IP address ( into the Internet Explorer browser address bar, entering a username and password and then finding the DHCP menu and disabling DHCP. If you have a DLink router, the username and password are usually both set to be 'admin' by default (or after pressing in the reset button for 20 seconds).

WARNING: Before you do this, I strongly suggest you save your current router settings to a file on your computer. My DLink refused to re-enable DHCP again afterwards even after updating the firmware and using the reset button! Only a restore from an old saved config file and rebooting it seemed to rescue it! Also check you can load the config file again - my DLink router refused to load the config file from C:\Users\Administrator\Downloads but would load the same file when I copied it to D:\ !!!!

Click to enlarge

Keep the IP address of the router as 192.168.x.1, turn off DHCP, save the settings and reboot the router.

IMPORTANT: Check that DHCP on the router is displayed as being off and if not re-try and reboot it again - it does not always seem to work first time!

3. Download and install tftpd32 (or tftpd64 if you are running 64-bit Windows). Run the program and allow Windows to unblock the Firewall when prompted by Windows (click on UnBlock).

4. Now set up the settings in tftpd32/64 as shown below:

The current directory is not important, it can be configured so that it always shows this path
by changing the Start Menu shortcut properties 'Working Folder' to C:\tftp\grub4dos.

We need to enable a TFTP and DHCP server only.

Note: set Option negotiation, Bind TFTP to the PCs IP address and Allow \ as virtual root.
These settings are important! Do not tick PXE Compatibility (except as a last resort!).
The Tftp port MUST be 69.

Set Boot File to grldr if you want grub4dos to boot (note the screenshot shows grldr_ but this is an artefact of the display, it should be set to grldr).
The DHCP settings should be set as above. This can support up to 10 PCs on the network (including wireless PCs) as the pool size is set to 10 (you can change it to more if you like).
New PCs will be assigned an IP address starting with the first one at, and the second one will be, etc.
The DLink router ( still acts as our DNS server and Default router (gateway).
Again Bind the address to that of your PC and enable Persistant (sic) leases.

Close tftpd32/64 and re-run it so that the changes take effect.

5. Finally, we need to make a new folder structure on your PC - C:\tftp\grub4dos\menu.lst (note that menu.lst is a folder and NOT a file).
Place the grub4dos grldr file in the c:\tftp\grub4dos folder this is the file that will be requested and run by the PXE client.
Place the menu.lst file that you want to use in the C:\tftp\grub4dos\menu.lst folder and rename the file to default (with no extension) - so we now have a file C:\tftp\grub4dos\menu.lst\default as the full file pathname.
Place any other files that would normally be on a USB drive in the C:\tftp\grub4dos folder

An example default file (aka menu.lst) might be:

gfxmenu (pd)/message

title 1 linux iso boot\nlinux must run from RAM only and not reference files on the ISO once booted to linux
map --mem (pd)/linux/linux.iso (0xff)
map --hook
chainloader (0xff)

title 2 Boot DOS floppy image
map --mem (pd)/images/floppy.img (fd0)
map --hook
chainloader (fd0)+1
rootnoverify (fd0)

title 3 Hirens Boot CD 13.2 using firadisk \nBoot to Hirens Boot CD in RAM - see tutorial #36
map --mem (pd)/firadisk.gz (fd0)
map --mem (pd)/HirensBCD.13.2.iso (0xff)
map --hook
root (0xff)
chainloader (0xff)

The tftp root folder is set to C:\tftp\grub4dos in tftpd32/64, so (pd)/linux/linux.iso refers to the file at C:\tftp\grub4dos\linux\linux.iso.
You must use --mem when mapping a file from a PXE (pd) device.
You cannot use the ls command with the PXE (pd) device.
If chainloading a file, you must use the --raw parameter.

See http://diddy.boot-land.net/grub4dos/files/pxe.htm for more information on grub4dos PXE booting and also the ReadMe file extract at the end of this Tutorial.

Ubuntu PXE boot (extracted from ISO)
See here
LABEL Ubuntu
MENU LABEL Ubuntu CD - Live
KERNEL images/ubuntu-13.10-desktop-i386/casper/vmlinuz
APPEND boot=casper vga=normal netboot=nfs nfsroot= fetch=tftp:// initrd=images/ubuntu-13.10-desktop-i386/casper/initrd.lz

Undoing the changes!

To undo these changes you just need to do 3 things:

1. Exit the tftpd32/64 utility to stop it acting as a DHCP server
2. Enable DHCP on your router again (or reload the config file that you saved earlier)
3. Go to your network control panel settings and set the TCP/IP settings back to 'Obtain IP address automatically' and 'Obtain DNS automatically' - though it should still work if you leave it set to a fixed address and it will save you having to enter the addresses in again if you later want to enable PXE booting again.

If you want to set the PC up as a PXE server again then:
1.Go to your network control panel settings and set the TCP/IP settings back to 'Use IP address' and 'Use DNS address' and set up the addresses as before.
2. Disable DHCP on your router
3. Run ftfpd32/64 - it should remember the settings.

Booting to WinPE3 over PXE

If you PXE boot to a WinPE v3 image, you can install any Windows OS onto the target PC/notebook. You can use ImageX or Ghost or any imaging tool that you prefer once you are running WinPE.
When the WinPE OS boots, you just need to connect to another system on the network (e.g. a shared folder on another PC). You can then run any imaging program or backup/restore the PC across the network. You could have a variety of installation DVD folde