Data Network Resource
       Earn on the Web


Bootstrap Protocol(BootP) and DHCP



BootP


The problem with using Reverse Address Resolution Protocol (RARP) (RFC 903) for assigning IP addresses to clients is that it operates at the data link layer and is therefore limited to the local LAN. Bootp however uses IP/UDP (port 67 for the server destination port, and port 68 for the client source port) and can cross routers. If a client does not know its own IP address when it boots up then it can utilise a Bootp server to obtain its IP address. It will use a IP broadcast address of 255.255.255.255. This IP broadcast is transmitted in a link-layer broadcast of FFFF.FFFF.FFFF. If the client is on the same LAN as the Bootp server, then the Bootp server will respond to the broadcast, by using the MAC address of the client, and the IP address will be given to the client. If the Bootp server is on another LAN i.e. on the other side of a router then we are left with the situation whereby broadcasts are being sent by the client and the router is designed not to pass broadcasts. Consider the following scenaro:

Bootp

  1. The client requires an IP address and a default gateway address so it sends out an IP broadcast BOOTREQUEST.
  2. No Bootp server exists locally so the router R1, which is configured to forward Bootp/DHCP requests, sends a unicast with the source IP address of it's LAN interface on which it received the initial broadcast. Note that this is different from TCP connections which use the WAN IP address on the router which owns the LAN interface from whence the packet came. The unicast contains the IP address of the Bootp server which R1 knows since this is part of the Bootp forwarding configuration.
  3. R2 forwards the unicast to the Bootp server.
  4. The server examines the packet and checks for the client's hardware address in its database. If the MAC address has been entered then the server can map the client MAC address to the IP address configured in the database.
  5. The server then looks to see if the client is requesting a configuration file (boot file).
  6. The server replies with a unicast BOOTREPLY containing the client's IP address and details of the configuration file.
  7. R1 recognises the unicast reply and forwards the packet to the clients MAC address.
  8. The client's TCP/IP stack then pings the IP address to check that it is not being used before taking it for itself.
  9. The client then can use TFTP etc. to download the configuration file including information such as the default gateway to the LAN interface of R1.

Note that the TCP/IP stack needs to be in place on the client, since the client needs to be able to send an IP broadcast (not a layer 2 broadcast!).

Below is the frame format which is used for both Bootp and DHCP:

Frame format

  • Operation - indicates a request 1 or a reply 2.
  • Hardware Type - Ethernet is 1.
  • Hardware Length - length of the address
  • Hops - the client starts this off with 0 and then this increment by each Bootp server if the packet is passed on.
  • Transaction ID - diskless nodes use this number to match responses with the requests.
  • Seconds - this gives the elapsed time since the client started the boot process
  • Client IP Address - if a client knows its IP address it puts it in here, otherwise it is a 0.
  • Your IP Address - the server puts an IP address here if the Client IP address field is 0.
  • Server IP Address - if the client knows this then the client can place the server address in here, otherwise the server does.
  • Server Host Name - same as previously.
  • Gateway IP Address - the client initially sets this to 0. The router receiving the packet will put the IP address of the interface on which the packet was received (i.e. the LAN interface).
  • Client Hardware Address - so that the servers/routers know where to send responses back to.
  • Server Host Name - if the client puts a specific server name in here then it restricts itself to booting from that server alone. If no name is in here then the client can boot from any server that responds to a bootp request.
  • Boot File Name - the client can request a specific boot filename.
  • Vendor Specific Area - up to 64 octets long for Bootp. This is called the Options field in a DHCP packet and is up to 312 octets long. In DHCP this field contains optional information that the server may wish to give the client e.g. client identifier and server identifier.

DHCP (Dynamic Host Configuration Protocol)


DHCP works slightly differently from Bootp. The following steps occur when a client retrieves IP configuration details from a DHCP server:
  • The client sends a DHCPDISCOVER IP broadcast to find available DHCP servers on its subnet. This broadcast message could give indications of the address required and the length of the lease.
  • A router configured with Bootp Relay agent forwards the request on to other subnets specified in the router configuration (e.g. Cisco's ip helper).
  • The DHCP server responds with a unicast DHCPOFFER containing an available IP address in the 'Your IP Address' field and other configuration parameters such as default gateway, subnet mask and lease time. This occurs when the DHCPDISCOVER has a 0 in the Client IP address field. The server should check that the IP address has not already been allocated. Optionally, the server could be configured to reserve previously allocated IP addresses. In the case of the server being on a different subnet to the client, this DHCPOFFER is sent to the client's router's LAN IP address which is the source of the original DHCPDISCOVER broadcast. Where the server and the client sit on the same LAN, the MAC address of the client is sufficient, being as it is the source of the broadcast.
  • The client examines the various offers it receives, picks one and sends a DHCPREQUEST broadcast including the server identifier of that particular server to obtain the offered configuration parameters. The DHCPREQUEST broadcast is also used to renew a lease or to decline an offer.
  • All servers receive this broadcast if they are on the LAN. If they are on another subnet and a relay agent is configured on the router, then this broadcast is unicast to the server identified by the server identifier. The router is configured with the IP address of the desired server.
  • The chosen server replies with a unicast DHCPACK containing IP address, duration for the lease of that IP address and the other configuration parameters. The server commits to this IP address and it is passed to persistent memory. A DHCPNACK is sent if the IP address happens to have been allocated in the meantime.
  • The client receives the DHCPACK and checks the IP address is not being used locally e.g. with an ARP request. If the IP address IS in use then the client sends a DHCPDECLINE, waits at least 10 seconds and then restarts the process.
The DHCP server may have a number of scopes configured for different subnets, it knows from which subnet a request comes from because the unicast sent from the local router contains the source IP address of the LAN interface on which the client's broadcast request was received.

RFC 951 describes Bootp in detail whereas RFC 2131 describes DHCP in detail (superceding RFC 1541).

Valid HTML 4.01 Transitional




Earn on the Web    


All rights reserved. All trademarks, logos, and copyrights are property of their respective owners.