====== Driver test: basic DHCP ====== ===== Rationale ===== 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. {{ :clipart:nic.jpeg?237x222|A network card}} ===== Test sequence ===== - Before starting, ensure that system power is off and the network cable is connected to a network which provides a DHCP server. - Power on and boot to the iPXE command line. - Use ifstat to identify the name of your network interface (hereafter assumed to be ''net0''). - Open the interface and initiate a DHCP request using ''[[:cmd:dhcp]] net0''. - Verify that the DHCP command completes without an error. - Use ''[[:cmd:route]]'' to verify that the assigned IPv4 address is in the expected range. ===== Troubleshooting ===== The easiest way to troubleshoot this test is typically to use a combination of ''DEBUG'' build options, the error counters displayed by ''[[:cmd:ifstat]]'', and a [[:howto:pcap|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 [[:howto:pcap|observe]] both your DHCP request and the server's DHCP response on the wire), then check the receive errors (RXE) reported by ''[[:cmd:ifstat]]''. In particular, look for errors such as [[http://ipxe.org/3c086003]] 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.