This is an old revision of the document!
dhcp [<interface>] [<interface>...]
dhcp
dhcp net0
:retry_dhcp dhcp || goto retry_dhcp
Configure a network interface using DHCP. iPXE will open the first specified network interface and attempt to acquire an IP address via DHCP. If DHCP succeeds, the command will terminate and the network interface will be left open. If DHCP fails, the network interface will be closed and iPXE will proceed to the next network interface in the list.
If no network interfaces are explicitly specified, iPXE will try all available network interfaces.
Success | One network interface was successfully configured using DHCP |
---|---|
Failure | No network interfaces were successfully configured using DHCP |
dhcp
will not automatically close all other network interfaces before starting to attempt DHCP. If you have already opened other network interfaces, then you may wish to execute ifclose
before executing dhcp
.
dhcp
will succeed if it manages to obtain an IP address. If you are using a ProxyDHCP server to provide a boot filename, then you may wish to keep retrying DHCP until it obtains a response from the ProxyDHCP server as well as obtaining the IP address from the DHCP server. You can do this using a script fragment such as:
:retry_dhcp dhcp && isset ${filename} || goto retry_dhcp