This tutorial explains how dhcp works.
DHCP stands for dynamic host configuration protocol. It is a client server protocol which has a DHCP client and a DHCP server. DHCP works on UDP protocol. DHCP clients work on UDP port 68 and DHCP servers work on UDP port 67. The following are the steps followed before which a DHCP client can receive an dynamic IP address.
1. DHCP Clients are not aware of the IP address of the DHCP Server, as it is not pre-configured. DHCP Clients requiring an IP address would send a broadcast message, which would be the DHCP Discover message. The message would contain destination port as UDP port 67
2. The above message would be sent to all systems on the network as it is a broadcast packet. DHCP servers on the network would process the packet , as it is targeted to the port number for DHCP servers. After a server receives the packet, it would respond with a DHCP offer message, contain the details of IP address which would be allocated to the specific client.
3. The DHCP client on receipt of the packet would respond with a DHCP request message which tells the server that it is going to use the credentials provided as its IP address and other relevant parameters.
4. The DHCP server on receipt, would send a DHCP Ack, which is the acknowledgement to the above message, confirming the assigned parameters.