2

I am working on setting up a 'PXE boot server', if that is a thing; what I have to work with is a TPlink router (TL-ER7206 v1.0), which offers a DHCP service with 'option 66' which should be set to the IP address of the TFTP server (but nowhere to set the filename, it seems). I may have to set up DHCP on a Linux server and disable the one on the router, but I'd like to see how far I can get with the router. Ultimately I'd like to get to a setup where the PXE booting client sees a menu of different OSes to install, but that is for the future.

But for now, is there a few commands I could use from the commandline in Linux to see what a PXE booting PC would get back from the server, without having to attempt an actual PXE boot? I know I can run something in Virtualbox, but I'd like to be able to test/debug this from the commandline.

2 Answers 2

4

To answer my own question - I have spent some time trying things out and realised what I needed was a way to see what the DHCP server replies, when PXE starts up.

PXE relies on two services:

  • DHCP for getting an IP address, which you will need for the next step.
  • TFTP, for serving the files you need for booting up.

DHCP not only gives you an IP address, but also points you to the TFTP server and the name of the first file you need for booting. To see what you get back from DHCP, I use two commands from two different sessions:

  • dhcpdump, which can conveniently be run in a screen. It will write out any traffic to and from the DHCP server.
  • nmap --script broadcast-dhcp-discover, which will request an IP address from the DHCP server.

Sample output from dhcpdump, which shows that the DHCP serves the filename, pxelinux.0 that I put in the configuration file, /etc/dhcp/dhcpd.conf:

root@vogon:~# dhcpdump -i enp8s0
  TIME: 2022-06-27 08:17:41.124
    IP: 192.168.50.177 (88:d8:2e:c3:83:77) > 192.168.50.9 (d8:5e:d3:5d:4:18)
    OP: 1 (BOOTPREQUEST)
 HTYPE: 1 (Ethernet)
  HLEN: 6
  HOPS: 0
   XID: b5cdb8de
  SECS: 0
 FLAGS: 0
CIADDR: 192.168.50.177
YIADDR: 0.0.0.0
SIADDR: 0.0.0.0
GIADDR: 0.0.0.0
CHADDR: 88:d8:2e:c3:83:77:00:00:00:00:00:00:00:00:00:00
 SNAME: .
 FNAME: .
OPTION:  53 (  1) DHCP message type         3 (DHCPREQUEST)
OPTION:  61 (  7) Client-identifier         01:88:d8:2e:c3:83:77
OPTION:  12 ( 15) Host name                 LAPTOP-PNGS5J2E
OPTION:  81 ( 18) Client FQDN               0-0-0 LAPTOP-PNGS5J2E
OPTION:  60 (  8) Vendor class identifier   MSFT 5.0
OPTION:  55 ( 14) Parameter Request List      1 (Subnet mask)
                          3 (Routers)
                          6 (DNS server)
                         15 (Domainname)
                         31 (Perform router discovery)
                         33 (Static route)
                         43 (Vendor specific info)
                         44 (NetBIOS name server)
                         46 (NetBIOS node type)
                         47 (NetBIOS scope)
                        119 (Domain Search)
                        121 (Classless Static Route)
                        249 (MSFT - Classless route)
                        252 (MSFT - WinSock Proxy Auto Detect)
                        
---------------------------------------------------------------------------

  TIME: 2022-06-27 08:17:41.124
    IP: 192.168.50.9 (d8:5e:d3:5d:4:18) > 192.168.50.177 (88:d8:2e:c3:83:77)
    OP: 2 (BOOTPREPLY)
 HTYPE: 1 (Ethernet)
  HLEN: 6
  HOPS: 0
   XID: b5cdb8de
  SECS: 0
 FLAGS: 0
CIADDR: 192.168.50.177
YIADDR: 192.168.50.177
SIADDR: 192.168.50.9
GIADDR: 0.0.0.0
CHADDR: 88:d8:2e:c3:83:77:00:00:00:00:00:00:00:00:00:00
 SNAME: .
 FNAME: pxelinux.0.
OPTION:  53 (  1) DHCP message type         5 (DHCPACK)
OPTION:  54 (  4) Server identifier         192.168.50.9
OPTION:  51 (  4) IP address leasetime      600 (10m)
OPTION:   1 (  4) Subnet mask               255.255.255.0
OPTION:   3 (  4) Routers                   192.168.50.1
OPTION:   6 (  8) DNS server                192.168.50.9,8.8.8.8
OPTION:  15 (  9) Domainname                somewhere.com
---------------------------------------------------------------------------

The next step, obviously, is to set up TFTP - there are many good guides, but I need to be able to choose between several OSes, and this article seems to be just the thing: Setting Up A PXE Install Server For Multiple Linux Distributions On Debian Lenny

1
  • The famous Ventroy project (loads many ISO from one USB drive) has a sub-project called iVentroy, that aims to load many ISO from one PXE server: iventoy.com/en/index.html Commented Oct 28, 2023 at 10:47
0

For testing, a web-server can be used as a "PXE boot server", doing the PXE boot without TFTP and by re-using the DHCP server that is already built into libvirt. Libvirt uses iPXE as the firmware for network booting in the network interfaces for VMs

The test boot computer should be a virtual machine. The web-server should be created with a particular folder architecture and with the chosen boot images.

See the article Easy PXE boot testing with only HTTP using iPXE and libvirt, that shows:

  • Web Server Setup
  • Libvirt network DHCP setup
  • PXE Booting using the virt-install command.

The whole is much too voluminous to include here.

1
  • Yes, I know that one - what I am looking for is actually Linux command that queries the DHCP server and returns the response as lines of text; I should probably have been clearer in my question.
    – j4nd3r53n
    Commented Jun 22, 2022 at 15:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .