How Does A DHCP Server Work?

Share This Post:

Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn
dhcp meme

Understanding How DHCP Works

You’ve all had the experience of turning on your computer and it automatically connects to the network.  Understanding how a DHCP server works is critical to your understanding of this process.  DHCP stands for Dynamic Host Configuration Protocol and a DHCP server, functioning on broadcast,  is responsible for handling the automatic distribution of the following within its broadcast domain (normally won’t propagate over a router):

  • IP address
  • Subnet mask
  • Address of the DNS server
  • Address of the default gateway

The DHCP process requires 2 components to work:

  • A device to distribute addresses (Server, Router, etc);
  • A NIC on a device which is set to “Obtain Address Automatically”; and
  • Remember, if you have a DHCP server, remember to shut off the router’s DHCP function.

The DHCP Process Workflow

The process of obtaining an IP address occurs at Layer 2 and occurs as outlined in the image below.

Dhcp process
Diagrammatic representation of the DHCP process.

DHCP Discover:  Newly connected computer sends out a “DHCP Discover” broadcast message
DHCP Offer:  One or more DHCP servers will respond with a “DHCP Offer”.   The computer will accept the first one.
DHCP Request:  The connecting device responds to the offer with a “DHCP Request”, confirming that the IP address from the offer is still valid and the IP address is still available.
DHCP ACK (Acknowledgement):  If the offer is still good, the DHCP server responds with “DHCP ACK”.  The server records that the particular IP address has been leased to a specific computer.  If the offer is no longer valid, the whole process starts over again.

What is APIPA?

Stands for Automatic Private IP Addressing is what a device gets when the DHCP process fails and is in the range of  169.254.x.x.   This address cannot communicate out over the address and can only use Layer 2 communications.

 

What is The Difference Between Static and Dynamic IP Addressing

Static IP Addressing

This is when set addresses manually for network devices whose addresses we do not want to change, such as our router, DHCP server, printers, etc.  Any device we connect to regularly.

We can have static addresses in a DHCP based network, but we have to set up reservations for them, so they don’t get handed out to other devices.

Dynamic IP Addressing

Connected devices receive a leased address automatically from within a range of addresses.   After a certain period of time, this address lease needs to be renewed.

What Are The Properties and Functions of a DHCP Server?

What is a DHCP Reservation?

Settings on our DHCP server reserving an particular IP address for a particular MAC address, so it will not be distributed to any other devices

When setting a static address or a reservation on a device, first set the static device on the devices itself so it doesn’t send out a DHCP broadcast message.

We also want to have reservations for devices that are used regularly and relied on by others :

  • Printers
  • Servers
  • NAS
  • IDS/IPS

DHCP Scopes

The range of addresses that the DHCP server will give out.

If we are working with a network in the 192.168.1.x range, we typically don’t want to have addresses being given out of this huge range if we don’t have all the devices, so you can set the scope to say:

192.168.1.50 to 192.168.1.150

You should also leave out the addresses we use for setting up on static devices out of the scope.

You may also have a situation where you have multiple DHCP servers on a network, so we will need to make sure that each server has different scopes to avoid having a situation where 2 devices have the same IP address.  Follow the 80/20 rule, so give one server 80% of the scope and the other server 20% of the scope.

IP Address Leases

DHCP IP addresses leases are of a fixed duration and need to be renewed periodically.  When a device gets near the end of the lease (87.5% of lease time), the device attempts to renew the IP address.  The renewal request continue until a response is received.

The renewal process is why you may see that your computer always seems to have the same IP address until you log off the network for a prolonged period of time.  The renewal and release process can also be done manually if needed.  The manual commands will not work if your NIC is set to standard.

Understanding DHCP Configuration Options

These are options that when we are setting up the server, we code in the options to be configured as network settings on the client computers.

OptionWhat It SetsDescription
050IP AddressIf we have an IP reservation for a computer, we set its 050 option.
051Lease Time
006DNS ServerIt could be one or multiple.
003Default Gateway
001Subnet Mask
015Domain Name

 

 

Share This Post:

Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn

Leave a Reply

Your email address will not be published. Required fields are marked *

Table of Contents

You May Like

Related Posts

How Does Cloud Computing Work
Linux Basics
Linux Administrator

How Cloud Computing Works

As a Linux administrator, your job may depend on knowing how cloud computing works. Cloud technology has moved computer resources and applications to shared network

Read More »