DHCP - Dynamic Host Configuration Protocol

What is DHCP

The meaning of DHCP is easily understandable when you know the words behind this abbreviation – namely Dynamic Host Configuration Protocol. That might sound complicated but in essence it is not. So the definition of DHCP is a client-server network management protocol taking care of automatic assignment of network configuration settings such as IP address, netmask, gateway, DNS servers. In other words DHCP is the system that makes it possible for your device to have internet access right after it connects to a router that runs a DHCP server.

How does DHCP work

DHCP (Dynamic Host Configuration Protocol) works upon request from the client-side device – in many cases that would be your laptop or mobile phone, printer or any other Internet-supporting equipment that you might have. In order for settings exchange to occur, your device must have a DHCP client service enabled in order to broadcast a DHCP request in the network that is just connected to. For example upon authenticating with a WiFi network or right after you plug in a LAN cable in your laptop, if it has DHCP enabled for the adapter in use – the WiFi adapter or your LAN adapter – then a DHCP protocol broadcast request will be sent in that local network. What happens next is that the DHCP server – for example your router that handles your local network and the WiFi as well, would see that broadcast request and if it has been configured to provide configuration information using that protocol, it would respond with the information that your device needs in order to obtain Internet access and connectivity in the network managed by the router.

Scheme of how DHCP Works

The reply would contain the so-called DHCP Options:

DHCP Options

The set of configuration options sent from the server to the client that eventually the client should configure for the network adapter in use

  • The proposed IP address that your device should set as a private IP

  • The Netmask or Subnet/CIDR that must be configured in order for connectivity between your IP and the gateway to work

  • DNS Server(s) to be set so that you would be able to convert domains to IP addresses (essential for any Internet access)

  • The IP address of the actual DHCP Server – as it’s required for renewal of the DHCP Options

  • The Lease Time – the time after which the client should make a new request to check if the network configuration should remain the same or must be changed.

DHCP Components

What is a DHCP Server

A DHCP Server essentially is a network-connected routing device that is not always but usually is your router used eventually as the gateway address for Internet connectivity. The DHCP server manages and automatically assigns IP addresses to the clients that request TCP/IP configuration information from it in the same network that the server and the clients are connected to. It is pre-configured with the IP ranges also called IP Address Pool that the DHCP server is allowed to provide and assign, the netmask that clients must use, the IP of the default routing gateway and optionally DNS server addresses used for name resolution. DHCP Servers are usually ran on the routers which serve as gateways but can also be running on a separate device.

What is a DHCP Client

That can be any type of device that has network capabilities – such as computers, laptops, mobile phones, printers, scanners, IoT devices, IP Cameras, Smart TVs and others. What makes them DHCP clients is them having a DHCP client service running used to request and configure a particular network adapter with the settings (Options) provided by the DHCP Server.

DHCP Lease Time

The DHCP Lease Time provided by DHCP Servers is a number in seconds which represents the suggested to the client time immediately after which the DHCP Client should request new or renewed DHCP Options from the Server. The purpose of that procedure is to make sure that configuration such as IP addresses is kept current and accurate according to the settings pre-set in the server in order to keep the client network organized and functioning and to avoid IP conflicts.

DHCP Relay Agents

Some network architectures require a routing device to transparently forward requests and responses between the clients and the DHCP server in order for successful configuration sets to be exchanged and such a routing device is called DHCP relay agent. Such a relay agent functions as a proxy between the client device and the server.

DHCP Relay Agent Operation Scheme

Benefits of using DHCP

  • Efficiency: This protocol ensures that configuration is being exchanged without the need of the people in need of connectivity to be tech savvy or to do complex manual configuration activities on their devices in order to get Internet Access.

  • Network Structure Optimization: It gives network administrators the ability to segment and organize their networks in a way such that different groups of clients based on various criteria can be mapped and assigned IP addresses within particular IP ranges (ip address pool).

  • Fast and Accurate Configuration Updates: Whenever it is needed for new IP address ranges to be used locally or the default gateway or DNSes to be modified, DHCP makes updating the reliable IP address configuration of all DHCP-enabled clients possible automatically. That results in time saved and cost-efficiency, not to mention hassle-free seamless functionality from the client side.

  • Prevents IP Addresses Conflicts: If presumed that all clients in the network are using the DHCP Service, the server assures that there are no 2 or more network devices using the same IP address.

Should DHCP be on or off

  • If you would need your client device to obtain the network configuration automatically without the help of a network administrator - e.g if you have no idea what the gateway is, what IP addresses are allowed to be set in the specific network you have connected to, the subnet mask, or if you should use the local DNS server instead of publicly available ones which can sometimes be filtered - then you should have DHCP turned on for your network adapter in use.

  • If you need to have a static local IP address which does not change every time you re-connect to the network in use, and you are certain that you know what IP addresses are allowed connectivity, the IP address of the default gateway, the subnet mask, and you either can use the gateway as a DNS or have external DNS servers unfiltered and available - then you can switch DHCP off.

DHCP vs Static IP address

Since the name of the DHCP Protocol contains the word dynamic, you can guess and will be correct to assume that by using a DHCP client you get dynamic IP addresses, which would probably change over time or whenever you disconnect and reconnect to a particular network. That while being convenient would not make it possible to benefit from the advantages of static IP addresses which can be but are not limited to port forwarding, QoS, and such. Bare in mind that using DHCP not always means that your device would get a different IP address each time it connects to the network. Network administrators have the ability to configure a DHCP server to assign a particular valid IP address to a particular MAC address - which is an unique identifier of each network adapter such as a LAN adapter or a WiFi adapter.

Pro-Tip:

It is not uncommon for Internet Connectivity to be limited if the DHCP protocol exchange that is in charge of assigning IP addresses fails due to misconfiguration from either the client or the server side. Which is why when you connect to a LAN network and you notice that your adapter has no TCP/IP configuration set, just try using by manually assigning an IP from some of the common private IP address ranges with their respective commonly used gateway IP address and subnet mask. Some of those are:

  • Network: 192.168.0.0
    Gateway: 192.168.0.1
    IP Address: 192.168.0.2-254
    Netmask: 255.255.255.0

  • Network: 10.0.0.0
    Gateway: 10.0.0.1 or 10.0.0.0.1
    IP Address: 10.0.0.2-254
    Netmask: 255.255.255.0

  • Network: 192.168.1.0
    Gateway: 192.168.1.1 or 192.168.l.l
    IP Address: 192.168.1.2-254
    Netmask: 255.255.255.0

Even if the network in question has a DHCP server enabled, that not always means that you have to use it in order to enable Internet connectivity and/or routing through the default gateway. Furthermore if you have access to your router admin panel you can modify, enable or disable the DHCP server functionality.