[Osaka/Yokohama/Tokushima] Looking for infrastructure/server side engineers!

[Osaka/Yokohama/Tokushima] Looking for infrastructure/server side engineers!

[Deployed by over 500 companies] AWS construction, operation, maintenance, and monitoring services

[Deployed by over 500 companies] AWS construction, operation, maintenance, and monitoring services

[Successor to CentOS] AlmaLinux OS server construction/migration service

[Successor to CentOS] AlmaLinux OS server construction/migration service

[For WordPress only] Cloud server “Web Speed”

[For WordPress only] Cloud server “Web Speed”

[Cheap] Website security automatic diagnosis “Quick Scanner”

[Cheap] Website security automatic diagnosis “Quick Scanner”

[Reservation system development] EDISONE customization development service

[Reservation system development] EDISONE customization development service

[Registration of 100 URLs is 0 yen] Website monitoring service “Appmill”

[Registration of 100 URLs is 0 yen] Website monitoring service “Appmill”

[Compatible with over 200 countries] Global eSIM “Beyond SIM”

[Compatible with over 200 countries] Global eSIM “Beyond SIM”

[If you are traveling, business trip, or stationed in China] Chinese SIM service “Choco SIM”

[If you are traveling, business trip, or stationed in China] Chinese SIM service “Choco SIM”

[Global exclusive service] Beyond's MSP in North America and China

[Global exclusive service] Beyond's MSP in North America and China

[YouTube] Beyond official channel “Biyomaru Channel”

[YouTube] Beyond official channel “Biyomaru Channel”

Getting started with DHCP for the first time

My name is Ito and I am an infrastructure engineer.

Do you know what DHCP is?
In fact, it exists nearby.

Can I connect to the internet at home or at work?

If you think it can be done, there is a high possibility that you are already using DHCP.

In this article, I would like to shed some light on DHCP, which is active in the shadows.

What is DHCP?

Roughly speaking, is it like this?
A protocol that allocates configuration information to enable communication with clients within a network .

When you connect a LAN cable to your PC, a pooled IP address is passed from the DHCP server, and
information about the gateway and DNS server is also passed and configured.
So, you can just plug in the LAN cable and start up the PC,
there is no need to configure network settings.

At this time, there is a DHCP server within the LAN, and the PC that is assigned an IP address from that server is called DHCP client

You will be able to access the Internet from your home PC without having to make any network settings.
That is "DHCP". At home, your router usually plays the role of DHCP.

The following are the settings that can be configured on the DHCP server.

  • IP address
  • subnet mask
  • default gateway
  • DNS server

In addition, there are other DHCP settings as follows.

  1. Lease period for various addresses
  2. Setting the scope (subnet range)
  3. Setting a reservation to assign a fixed IP to a specific PC

A brief explanation of each of the three settings is as follows.

Lease period The period during which the assigned IP address can be used, and when the lease period ends, the DHCP client will obtain an IP address again.
scope 1 scope = 1 subnet. For example, "192.168.1.2 to 192.168.1.129" and "192.168.1.130 to 192.168.1.253" are scopes.
reservation A function that continues to assign the same IP address to DHCP clients with specific functions (e.g. servers)

This setting is possible, but how does DHCP allocate IP addresses?
Let's dig a little deeper into DHCP.

More specific movements of DHCP

To use DHCP, the DHCP client must be able to receive an IP address.
DHCP is an abbreviation for ``Dynamic Host Configuration Protocol,'' which is a protocol that dynamically configures hosts,
so DHCP client C must be in a state where network settings can be configured dynamically.

dhcp
This is the situation on Windows. By default, Windows is set to receive DHCP, so you don't need to worry about it too much.

For Windows 10, you can check below.
Check the properties of the target network from [Control Panel] - [Network and Sharing Center] - [Change adapter settings]

If you need to statically allocate an IP address, please do so manually as described above.

When a DHCP client receives an IP address

I will briefly outline the process by which a DHCP client receives an IP address.

  1. Broadcast a request to "I want an IP address" when starting the client (DHCPDISCOVER)
  2. The DHCP server broadcasts the setting “Please accept this IP address” (DHCPOFFER)
  3. The client broadcasts a request saying "Then use this IP address" (DHCPREQUEST)
  4. DHCP server returns OK/NG (DHCPACK/DHCPNAK)

What do you think? The secret is to communicate several times via broadcast.
After all, the IP address has not been determined yet.
It is also assumed that there will be multiple DHCP servers.

When the IP address lease period is about to end

When an IP address is assigned, the assigned IP address is linked to the MAC address of the DHCP client, and
the lease period of the target IP address is managed.
Therefore, even if the DHCP client and server do not communicate, the target IP address will continue to be assigned.
However, if there is no communication after the lease period, the target IP address will be returned to the DHCP server.
Also, when connected to the network, it performs the same operation as when receiving data earlier.

Now, I will write a little more detailed information about leases.

  1. When the lease period is halved, send a request to extend the use of the same IP address to the server (do the same thing as when receiving an IP address)
  2. If you send an extension request to the DHCP server and there is no response (DHCPACK), it will fail.
  3. Periodically sends an extension request to the DHCP server
  4. If the lease expires without a response, the IP address will be leased.

What do you think? The clever thing about DHCP is that it basically tries to use the same IP address.
By doing this, you will not have to think about setting the IP address again.
This means that the load on the DHCP server will not increase.

This is how DHCP works.
So why is there a protocol called DHCP?
It would be nice if everything was allocated statically. . . Isn't that what you think?

What are the benefits of DHCP?

If you don't use DHCP, you have to configure "IP address/gateway/DNS server" for all devices...
just thinking about it gives me chills.

Administrators in internal systems departments, etc. will benefit greatly from this.
This is because if you assign statically, you have to manage which device has which IP address. .

The big advantage is that centralized management is possible with just a DHCP server.

On the other hand, the disadvantage is that if the DHCP server goes down and cannot be recovered,
all DHCP clients may be unable to communicate.
It's a big deal, but since it's a rare accident, it might not be something to worry about.

summary

What did you think?
You may not be used to hearing about DHCP, but your home PC probably uses DHCP.
We also use DHCP to assign IP addresses to each client.

DHCP is convenient, but if you don't decide on the configuration at the construction stage, you may end up in trouble.
If the IP is not returned even after the lease period has passed,
it is possible that there will be a shortage of IPs and users will get angry.

Please plan your use accordingly.

If you found this article helpful , please give it a like!
0
Loading...
0 votes, average: 0.00 / 10
1,528
X facebook Hatena Bookmark pocket
[2025.6.30 Amazon Linux 2 support ended] Amazon Linux server migration solution

[2025.6.30 Amazon Linux 2 support ended] Amazon Linux server migration solution

The person who wrote this article

About the author