Fundamentals of communication and networkingː Dynamic Host Configuration Protocol (DHCP)
DHCP (Dynamic Host Configuration Protocol) is a method of automatically allocating IP addresses to machines on a 'need to use' basis. Rather than have every machine in the network given a fixed IP address we allocate IP addresses to those machines as and when they connect. The key word in DHCP is "dynamic." - instead of having just one fixed, specific IP address, most computers will be assigned one that is available from a subnet or "pool" that is assigned to the network.
Stages of DHCP
When a host wants to join a DHCP network it will broadcast a DHCP discovery message over the network. At this point the host doesn't know the IP address or subnet of the DHCP host, so it will broadcast to all the nodes on the network
The DHCP server will respond to the message that the new node is broadcasting and send a reply containing a proposed IP address, network mask, lease time and a transaction ID. It would then record this information in its own datastore.
The new node must accept this offer
The new node and DHCP server then confirms the requested parameters
Advantages of DHCP
- It is possible to have more machines than available IP addresses on the assumption that everyone wont be using the network at once.
- We don't have to manually assign IP addresses and so saves time and avoids the possibility of accidentally assigning the same IP address twice.
Disadvantages of DHCP
- Tracing internet activity may be difficult as the same machine may have two or more different IP addresses over a period of time.
- Not having a static IP means computers with DHCP cannot be used as servers as their IP will change