~~PAGEIMAGE:network:tcp_ip:media:img:dhcp-flow.svg~~ ====== DHCP ====== {{template>:meta:template:pageinfo#tpl |desc=Introduce the working flow of **DHCP** (Dynamic Host Configuration Protocol).}} **DHCP** is a client/server protocol that automatically provides an Internet Protocol (IP) host with its __IP address__ and other related configuration information such as the __subnet mask__ and __default gateway__. ===== Interaction Flow ===== {{ :network:tcp_ip:media:img:dhcp-flow.svg }} Figure 1. Flow of DHCP client requesting configuration from DHCP server As shown in [[#figure1|Figure 1]], the interaction flow between DHCP server and client is as follows. - **DHCP Client** broadcasts a ''DISCOVER'', and the packet is copied and forwarded to **DHCP Sever1** and **DHCP Sever2**. - **Server1** and **Server2** send an ''OFFER'' to **Client** respectively. - **Client** can select an ''OFFER'' to respond to. \\ In the figure 1, **Client** only responds to the first ''OFFER'' received, i.e. ''Offer S1''. And the second ''Offer S2'' is ignored. - **Client** broadcasts a ''REQUEST'' requesting the ''Offer S1''. - **Server1** sends an ''ACK'' to the **Client**, telling the client that the IP configuration is available. And **Server2** will clear the state machine associated with the **Client**. - **Client** broadcasts an ''ARP'' to perform **ACD** (Address Conflict Detection), which is to detect if the IP configuration conflicts with other client. - If **ACD** fails, **Client** sends a ''DECLINE'' to **Server1** to tell the server that the IP configuration is unavailable.