Networking Foundations: Dynamic Host Configuration Protocol

Dynamic Host Configuration Protocol

Hello ladies and gentlemen, PySec here coming at you with another informative(hopefully) article for you all. In the last tutorial, we finally finished our discussion about IP Addressing and I intentionally didn't mention a really important concept with which IP Addressing wouldn't be feasible without it. What I'm talking about is how our network device gets the IP Address in order to communicate with other devices on the network/Internet. There are many different ways for that to be accomplished and that's what we will discuss about in this tutorial. I'll try to make it as simple and as short as possible.

Specifically, today's tutorial emphasizes the following:

  • Static IP Addressing
  • DHCP (Dynamic Host Configuration Protocol)
  • DHCP Relay

Static IP Addressing

One of the ways, which is mostly used for servers and "key" devices such as printers and routers is where you get involved and statically assign it.

The picture above shows how the network properties look like on a Windows machine. I'm sorry but I don't know how to find those properties on others operating systems but I may google it and figure it out. If you are on Win7 like me(it should work for different versions as well), in order to find those properties:

  1. Click the Start Button
  2. Click on Control Panel
  3. On the top right of the window there is a search bar, type "network" and a list of results should pop up
  1. Click on "View network connections".

In your case you may not be having the same results, but you will likely have a "Local Area Connection" icon.

  1. Right Click on the "Local Area Connection" icon and click properties.
  1. Select "Internet Protocol Version 4 (TCP/IPv4), click properties and voila!

Probably your window looks like mine, with the "Obtain an IP address automatically" option chosen. As you can see, there is another option called "Use the following IP address" where you can statically assing an IP address, Subnet mask and a Default gateway for your machine and the reason you would want to do that is for machines that you wouldn't want the IP address to change. Play around with it if you want but make sure you have the "Obtain an IP address automatically" option chosen before you close the window.

Now imagine you had 100 computers on your network. Wouldn't it be unwise and time consuming to go to the computers and manually assign to each one of them an IP address? It becomes a nightmare actually if you ask me because first of all you would have to type them all in and second of all what happens if a machine gets replaced and somebody forgot it and they type in a duplicate and you get errors across the network. So static addressing doesn't scale to all the computers in your network, it's mainly used for devices we mentioned above.

What most of the devices will use is DCHP, the Dynamic Host Configuration Protocol.

The picture above is a simplified use of a DHCP Server. We as clients are sitting at our home and we are connected to the DHCP Server via our router. Simple as that. We, as network admins we will have already configured a "pool" of addresses, which our network device can request from it so it can have an IP for itself. I won't get into the configuration part because it's not the point of this article, but I'll tell you that every DHCP Server has a scope. That scope includes a starting and an ending point of a range of IP addresses. For example, the DHCP server will hand out IPs starting from 192.168.2.50 and the last IP it can hand out is let's say 192.168.2.100. You can also configure the subnet mask, add IP exclusions. What I mean by IP exclusions is a range of addresses that are not distributed by the server. Furthermore, there is the lease duration, which means for how long you want to hand out these IPs for, what is the duration of the lease before the client has to give it back if they are not using it. Moreover, there is the option of setting an IP for the default gateway and many other options but we are not interested in it right now.

The concept is that the DHCP server we are connected to, is connected to a pool of addresses and as our computer boots up it sends a Broadcast message saying "Helloooooo, I need an IP Address!" and all the the differenct devices on that network will receive that message, because it's a Broadcast, as well as the DHCP server and the server says "oh fantastic, let me hand you one from my pool and you can use this for however long you have configured that lease time." So DHCP is Broadcast base, keep that in my mind because what we have discussed in previous tutorials is that Broadcast doesn't go over the router, it only exists in the LAN(Local Area Network).

You can setup a DHCP server, like a Microsoft server, you can google it if you are curious but you can also use a router as a DHCP server. Most of the routers nowadays include DHCP services. The picture below shows exactly what kind of communication is happening between the server and the client.

In other words, our network device does a DHCP Discover once it boots up, the server responds back with an offer from its pool of addresses it's connected to, our device makes a DHCP Request saying "I want this IP, I want this IP" and finally the server acknowledges that request with the so called DHCP Ack, simple as that.

DHCP Relay

DHCP Relay is such an important concept. From what we have talked about, especially in the previous tutorial I think that you guys and girls can get this. You don't? Alright, let's have an example then.

Let's say you have an organization and a whole bunch of small offices, right? Let's name the offices. Office 1 will be the IT support department in Sweeden, office 2 will be the telecommunications department in Netherlands and office 3 will be the programming department in Denmark and each office has its own clients ofcourse connected to the network. You don't want to buy a DHCP server and plug it in for each office because that's expensive. You may say "why don't you use the router of each office as a DCHP server and have it hand out the IP addresses.", but just for the sake of the argument we don't want to do that.

So all of these offices are connected to the main router in Estonia. This is where your corporate network is, you've got tons and tons of clients and switches and servers and hundreds of users working at that office and right there you want to run DHCP services from a central point. Meaning, if there is a client at that office asking for an IP address it will connect to the server and get the IP because they(the DHCP server and the client) are on the same network, the LAN, but you want to set it up that way so the other remote offices can also get their IP address from that DHCP server.

Well, that's a problem, isn't it? Why? Because DHCP is based on Broadcast. So if a device from the remote offices boots up saying "Helloooo network, can somebody help me out and give me an IP address?", what is going to happen? Nothing, absolutely nothing. Why? Because DHCP is Broadcast, which means that DHCP will respond back only to the LAN Broadcast messages, not to the remote offices. Routers stop the Broadcast. Imagine every router allowing the Broadcast going out on the Internet. Nightmare, hell! Tons of broadcasts happen every other moment and letting those go out on the Internet, would make Internet a really "noisy" place, thus, slow. Router's functionality is also working as separators between the LAN and the outside world.

So the Broadcast stops, it doesn't travel any further, unless you enable DHCP Relay. DHCP Relay is everywhere, all over the place, so i want you guys and girls to know that it exists. You can go to your router by configuring it and enable DHCP Relay, which takes a Broadcast message IF it's a DHCP Request and sends it to the DHCP server. DHCP Relay says "I'm going to look for DHCP Request and I'm going to send that via a packet as a Unicast with all the destination and source headers and send it directly to the DHCP server." and the DHCP server responds back "Ok I've got an IP address for you, let me hand it to you." It actually hands it to the router and the router responds back to the client as if it was giving it an IP address which is amazing because that way we can centralize all our DHCP services at one spot.

That's all for now. I described just one example of DHCP Relay but once we explore different technologies especially VLANs(Virtual Local Area Network), you will realize that there is so much more DHCP Relay can accomplish. I hope this article has been informative for you and I would like to thank you for taking the time to read it. Have an awesome day and as always if you have any questions feel free to post them down below.

Later...

Just updated your iPhone? You'll find new emoji, enhanced security, podcast transcripts, Apple Cash virtual numbers, and other useful features. There are even new additions hidden within Safari. Find out what's new and changed on your iPhone with the iOS 17.4 update.

1 Comment

Share Your Thoughts

  • Hot
  • Latest