Driver test: basic DHCP


Obtaining an IPv4 address via DHCP is probably the simplest test of the complete transmit and receive datapath. This test should therefore be attempted before any of the more complex datapath tests.

A network card

Test sequence

  1. Before starting, ensure that system power is off and the network cable is connected to a network which provides a DHCP server.
  2. Power on and boot to the iPXE command line.
  3. Use ifstat to identify the name of your network interface (hereafter assumed to be net0).
  4. Open the interface and initiate a DHCP request using dhcp net0.
  5. Verify that the DHCP command completes without an error.
  6. Use route to verify that the assigned IPv4 address is in the expected range.


The easiest way to troubleshoot this test is typically to use a combination of DEBUG build options, the error counters displayed by ifstat, and a packet capture on the DHCP server.

Start by verifying that the DHCP request is transmitted intact; there's no point attempting to debug your receive datapath (which is generally more complex) until the transmit datapath is working as expected.

Once transmit is definitely working (as verified by being able to observe both your DHCP request and the server's DHCP response on the wire), then check the receive errors (RXE) reported by ifstat. In particular, look for errors such as which could indicate that your driver is receiving empty or garbage data. You may need to start dumping the contents of received packets in your driver using code such as:

  // temporary hack - dump content of received packet
  DBGC_HDA ( netdev, 0, iobuf->data, iob_len ( iobuf ) );

Check that your driver is actually filling in the length of received packets using iob_put(); if not, then iPXE will see all received packets as having zero length.

dev/drvtest/dhcp.txt ยท Last modified: 2013/07/15 20:59 by mcb30
Recent changes RSS feed CC Attribution-Share Alike 4.0 International Driven by DokuWiki
All uses of this content must include an attribution to the iPXE project and the URL
References to "iPXE" may not be altered or removed.