Sunday, 28 May 2017

BOOTP and DHCP

 

Before we start our discussion on BOOTP and DHCP, it would be better that you read about RARP server, which will make you appreciate BOOTP and DHCP.

BOOTP (Bootstrap Protocol):

The Bootstrap Protocol (BOOTP) is a computer networking protocol used in IP networks to automatically assign an IP address to network devices from a BOOTP server. The concept is very similar to RARP but it comes with an advantage. 

In RARP we had one RARP server per network, which lead to inconsistency in the network. BOOTP overcomes that problem by using Relay agent. Instead of using one RARP server per network, BOOTP uses a single BOOTP server and in all other networks, it places one relay agent. Something like this:



Every BOOTP server has a static mapping table, which maps MAC addresses to IP addresses. The network which has BOOTP server can send a broadcasting message on the network. BOOTP server on reading the message assigns an IP address to the node. 

But the nodes which are on a different network cannot directly contact BOOTP server as they don't have the IP address of BOOTP server (BOOTP server is on a different network). These nodes transmit a broadcast message in their network. This message is read by the relay agent. Relay agent on behalf of the node sends a unicast message to BOOTP server asking for a new IP address (Note: This packet cannot be discarded by the router as it is unicast packet). 

BOOTP server on seeing this request assigns a new IP address to the node and sends the IP address and the acknowledgement to relay agent. Relay agent forwards this message to the node. And that is how the node gets the IP address. 

But there is a flaw in this as well, the static mapping table. Assume we have 1000 hosts on the 4 networks shown above. But out of these 1000's hosts, only 2 are active at any given time. But since the table is static we need to have entries for all the hosts the networks. At any given time only two entries are used and rest 998 becomes overhead and simply consumes space. This problem was solved by DHCP by introducing dynamic mapping table.

DHCP(Dynamic host configuration protocol):

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 (This definition I have copied from the Microsoft's website). 

DHCP working is almost similar to BOOTP but it overcomes the drawback of BOOTP i.e static mapping table. DHCP server has a table which is divided into two parts one is static and another is dynamic.


The static part contains the MAC and IP addresses of those machines which don't change their IP addresses frequently and which are more likely to be online all the time. These includes the servers, workstations and some reputed organisations such as Google, Facebook, Amazon etc.


The dynamic part of the table includes those nodes which are very likely to move in and out of the network and are very frequently changing their IP addresses. For these nodes, the DHCP server has a pool of IP addresses. Whenever a node requests for an IP address the server grants the IP address for a fixed amount of time to the node (Remember to contact the DHCP server a node has to follow the same set of procedure as we did in BOOTP). This time is called lease time

Whenever lease time of the node is about to get over, the node sends a renewal request to DHCP to renew its IP address. The node trying to renew the IP address sends the renewal request at the midway of lease time. For example, if our lease time is 10 mins, it will send a renewal request at 5 mins. This is implementation dependent but most of the networks follow this strategy.

With the introduction of the dynamic table, there is no wastage of memory. The mapping table contains only the active node entries. The number of entries is equal to the number of active hosts.

Advantages of DHCP:

  • Only one DHCP server is required.
  • The mapping table is dynamic and the size of the table is reduced to the number of online hosts.

If you are preparing for any competitive exams like GATE you should remember the following points.
  1. BOOTP and DHCP requests are originated from the application layer.
  2. RARP request comes from the network layer.
  3. DHCP is backwards compatible and runs at the same port number as that of BOOTP.
Hope this was helpful. Leave your questions, answers and suggestions in the comment section below. And make sure to like us on Facebook and follow on Google+.

Thank you!