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