What is Dynamic Host Configuration Protocol (DHCP)?
Have you ever wondered how your laptops and smartphones communicate with a network after using that magical WiFi password? Perhaps you heard of something called an IP address. Let's face it. If you are reading this article, you most likely have, and you want to know how devices get that IP address. You might be curious how that entire mechanism works, too. This is because of a protocol called DHCP.
While it's impossible to cover the entire scope of how DHCP works in a 1000+ word article, we can offer you an excellent primer on the subject instead. And, that is precisely what we are going to discuss today. So, let's get into it!
Ready to Learn Networking Fundamentals?
CompTIA's Network+ certification is a vendor-neutral, entry-level certification — meaning that the knowledge and skills it covers can be applied universally regardless of vendor. For that reason, CompTIA certifications are an excellent starting point for those who are new to IT. And Network+ is designed to help learners build a strong networking foundation.
This isn’t to say that certifications offered by industry-leading vendors aren’t valuable. For example, the Cisco CCNA cert is one of the most widely recognized certifications in the IT industry. Lucky for you, CBT Nuggets has CCNA online training, too.
What is an IP Address?
An IP address is much like a physical street address. Each IP address tells your network where your computer is located. That IP address also uniquely identifies your device, too.
Of course, this explanation is a severe oversimplification. IP addresses don't tell your network the actual physical location of your computer like a street address for a business would. IP addresses tell the network how to get information to your computer and how data needs to flow through the network to get to it.
In a traditional network, each device (computers, laptops, printers, etc…) needs to be assigned an IP address before those devices can send and receive data. Those IP addresses can be assigned manually or automatically. Today, it's common for a server to manage IP addresses automatically for the various devices attached to the same network.
What is DHCP?
DHCP stands for dynamic host configuration protocol. DHCP is only a standard, however. By itself, it does very little. Devices that use the DHCP protocol depend on a DHCP server to function.
When a device is attached to a network, it sends out a broadcast signal to look for a DHCP server (assuming a device is configured to use DHCP). This is kind of like screaming in a warehouse to find its supervisor. You know the warehouse supervisor is in there somewhere, but you don't know where yet. With any luck, your warehouse supervisor, or the DHCP server in this example, will holler back at you.
Once the DHCP server responds, it asks who you, or who your computer, is. Typically your computer responds with a MAC address. A MAC address is a unique identifier assigned to a network adapter by its manufacturer. It's possible for a single device to have multiple MAC addresses if it has multiple network adapters.
Once your device responds to the DHCP server with its MAC address, it will look through its list of devices to see if it already has an IP address assigned to it.
Oh yeah. We need to point out two important things after that last sentence.
First, a DHCP server keeps track of all of the devices it manages at any given time. DHCP servers do this so that it doesn't keep assigning devices new addresses every time they connect to a network. IP addresses are in limited supply, so DHCP servers can't hand out IP addresses like beads at Mardi Gras.
Second, IP addresses have a lease time. Think of this like a lease on a house or a car (except there's no money or contract involved). Your DHCP server will have a preconfigured lease time. For example, a DHCP server might issue leases on IP addresses for three days at a time. While a device is connected to a network, the DHCP server will contact that device to see if it still needs its IP address. If that device does, the DHCP server renews the lease. If that device doesn't respond to the DHCP server, the lease for that IP address expires after three days, and that IP address is up for grabs by other devices again.
So, a DHCP server is a fancy logistics manager for IP addresses for a network.
Why Do We Need DHCP?
DHCP servers aren't designed for the common person. Well, they are, but only as a side effect. DHCP servers were designed to make systems administrators' lives much more manageable. Here's why.
In the beginning, systems administrators needed to assign each device an IP address by hand. Sneaker Net is as slow as tired snails, though. Walking to each device in an organization to manually configure IP addresses wastes tons of time.
On top of that, systems administrators needed to track IP address information by hand. This was during a time when laptops and spreadsheets weren't a thing yet. Managing assigned IP addresses for a handful of devices isn't that hard, but can you imagine how difficult it is to track hundreds or thousands of devices spread across a large campus? Mistakes will happen, even in a time during which tablet computers and spreadsheets are plentiful.
Thus, the DHCP server was born. DHCP servers now handle IP address management for all networks, including home networks. DHCP functions are essential tools for network operators and vendors creating products for the home.
Should I Assign Static IP Addresses?
Nowadays, it's considered bad practice to assign an IP address to a device manually. Of course, there are times when that rule needs to be broken, but nonetheless, manually assigning IP addresses is frowned upon. Here's why.
DHCP servers are great tools that can manage IP addresses for us. Sometimes devices need to keep the same IP address, though. For instance, web servers need to keep the same IP address so outside traffic can flow to and from that web server. Due to how networks are commonly architected, web servers are hardly ever exposed directly to the internet. Traffic typically has to flow through NAT-enabled routers and firewalls first. If the IP address changes on a web server, other network configurations need to be made before traffic can begin flowing to and from that webserver again.
Someone realized this issue many moons ago, though, and fixed it. DHCP servers can permanently assign IP addresses to the same device. That means DHCP servers can act as a complete administration hub for network-assigned IP addresses.
Because of this, it's now considered bad practice to assign IP addresses manually. By manually assigning IP addresses, systems administrators create more work for themselves. That also creates a potential for a DHCP server to lease an IP address to a device when that IP address is already manually assigned to another device. Depending on how the information system is architected, manually assigning IP addresses may create DNS issues (though these are less common but something to be aware of nonetheless).
Learning DHCP is one of the first things you should do as an IT tech. DHCP, as well as DNS, are parts of the basic building blocks of networking today. Thankfully, DHCP is easy to learn. Much like the game Go, it can be challenging to master, though.
If you want to learn more, consider taking an online networking course. CBT Nuggets has a variety of entry-level certification andnetworking skills courses to get you started.