听说过DHCP吗?它是让互联网每天正常工作的技术之一,大多数人不知道它的存在,更不用说知道它的作用了。但是,您可能听说过朋友或工作中的IT 人员(IT guy)提到DHCP、DHCP服务器或DHCP客户端等术语。你(Were)想知道那些乱七八糟的东西是什么吗?如果您想了解 DHCP 是什么、DHCP是如何工作(DHCP work)的以及它的用途,请继续阅读。在本文中,我们将解释所有这些以及更多内容:
什么是 DHCP?
DHCP 是动态主机配置协议(Dynamic Host Configuration Protocol)的首字母缩写。它是一种网络管理协议(network management protocol),服务器使用它来自动为连接到它们的计算机和设备分配 IP 地址。(used by servers to automatically assign IP addresses)
在局域网 ( LAN(LANs) ) 上,例如您的家庭或中小型办公室,提供DHCP的服务器通常由路由器运行。在大型网络中,例如由大公司或政府机构维护的网络,DHCP可以由专用服务器(专用计算机)提供,而不是简单的路由器。
除了 IP 地址,DHCP还可用于自动为给定网络中的计算机和设备分配子网掩码(subnet mask)、默认网关(default gateway)和DNS服务器。(DNS)
DHCP 是如何工作的?
要了解DHCP的工作原理,您必须首先了解 IP 地址是什么的基础知识。简而言之(Put),IP 地址是连接到网络的计算机和其他设备的唯一标识符。网络中的PC(PCs)和其他设备(打印机、智能手机等)需要(network need)IP 地址才能在它们之间进行通信,向同一网络或互联网上的其他设备发送和接收数据。IP 地址适用于计算机网络,就像街道地址适用于城镇一样。您需要他们能够四处发送消息,知道它们被发送到哪里以及从哪里开始。
网络中的每台计算机和设备(computer and device)都需要一个有效的IP 地址(IP address)才能访问,并且计算机或设备(computer or device)可以通过两种方式获得一个。计算机(Computers)和设备可以使用静态(static)或动态 IP 地址(dynamic IP addresses)。静态 IP 地址(Static IP addresses)不是由服务器或路由器分配的。相反,它们是由您或您的网络管理员手动配置的。
(Dynamic IP addresses,)另一方面,动态 IP 地址不是手动分配的,因此得名。它们是动态分配的,如果您愿意,也可以自动分配。谁或什么分配了他们?答案是DHCP,即动态主机配置协议(Dynamic Host Configuration Protocol)。
当网络中的计算机或设备(computer or device)想要连接到其他人并与他们进行通信时,无论是在本地还是在 Internet 上,都会在短时间内发生一些事情:
- 想要连接到网络/互联网的计算机或设备向其(computer or device)服务器或路由器(server or router)询问IP 地址(IP address)。主机或设备(host computer or device)发送的消息称为DHCP 发现(DHCP discovery)请求。
- 当服务器/路由器收到请求时,它将请求转发给其DHCP 网络(DHCP network)服务。服务器/路由器上的DHCP 服务(DHCP service)会查看其他计算机和设备尚未声明的可用IP 地址。(IP address)一旦DHCP server/router识别出空闲IP 地址(IP address),它就会将其发送到请求它的计算机或设备(computer or device)。这部分过程称为DHCP 提供(DHCP offer)。
- PC/device接收到动态分配的IP地址(IP address)并将消息发送回DHCP server/router,确认它想要使用该IP 地址(IP address)。此步骤称为DHCP 请求(DHCP request)消息,因为主机实际请求提供的IP 地址(IP address)。
- 当DHCP server/router收到请求消息(request message)时,它会向启动整个过程的计算机或设备(computer or device)发送最终消息。此消息称为DHCP 确认(DHCP acknowledgment),包含授予对计算机或设备(computer or device)的网络/互联网访问权限所需的所有其他配置信息(configuration information),例如网关和 DNS 服务器(gateway and DNS servers)。
- 最后,DHCP server/routerIP 地址(IP address)标记为被请求它的计算机或设备(computer or device)占用和使用,它们现在可以与本地网络上的其他设备通信并访问(network and access)互联网(如果可用)。
DHCP 租用时间是多少?
现在您知道了DHCP如何自动为计算机和设备分配 IP 地址。但是,从DHCP 服务器(DHCP server)接收到的 IP 地址不是永久的,您可能会想。IP 地址池是有限的,这意味着网络中可用的地址非常多。
此外,某些连接的计算机和设备可能不会永久保持打开状态,或者可能不会一直连接到同一个网络。这意味着,如果它们动态分配的 IP 地址是永久的,即使不再需要它们也会占用它们。因此,DHCP仅在有限的时间内临时分配 IP 地址。该时间称为DHCP 租用时间,(DHCP lease time,)您可以从这篇文章中了解更多信息:如何在Windows 10中更改(Windows 10)DHCP 租用(DHCP lease)时间。
总之,DHCP 租用时间(DHCP lease time)是一项功能,它允许DHCP服务器在经过指定的时间段后回收未使用的 IP 地址。
谁发明了DHCP?
虽然您现在知道为什么发明DHCP以及它的用途,但您可能还想知道DHCP是如何诞生的以及是谁发明了它。它的历史可以追溯到 1984 年,当时作为互联网标准权威的互联网工程任务组 (IETF)(Internet Engineering Task Force (IETF))创建了一个称为反向地址解析协议 (RARP)的(Reverse Address Resolution Protocol (RARP))网络协议(network protocol)。RARP 允许没有磁盘驱动器的计算机(称为无盘工作站——它们通过直接从中央服务器加载操作系统(operating system)来启动)自动接收 IP 地址。
然而,RARP难以实现和配置,因此很快(在 1985 年)改进为另一种称为BOOTP(引导协议)的(Bootstrap Protocol)网络协议(network protocol)。BOOTP服务器可以在多个子网上自动分配 IP 地址。
DHCP源于BOOTP,但也能够动态分配指定范围内的 IP 地址,以及在不再使用时回收它们(DHCP 租用时间(DHCP lease time)),并为网络计算机和设备提供其他配置选项,例如 IP 地址网关或DNS服务器。DHCP于1993 年标准化,(standardized in 1993)此后不断得到改进。
您还有其他关于DHCP的问题吗?
现在您知道DHCP的含义和DHCP的作用了。这不是计算机世界和网络(computer world and networking)的一个小奇迹吗?您还有其他关于DHCP的问题吗?如果您这样做,或者您有什么要添加到我们的文章中,请随时在下面发表评论。
What is DHCP? How does it work?
Εver heard abоut DHCP? It is one of those technical things that keeps the internet working every day, and most people have no idea that it exists, let alone know what it dоes. However, yоu may have heard a friend or the ІT guy from work mentioning terms likе DHCP, DHCP servers, or DHCP clients. Were you wondering what all that gibberish was abоut? If you want to know what DHCP is, how does DHCP work, and what it's used for, read on. In this artiсle, we explain all that and more:
What is DHCP?
DHCP is an acronym for Dynamic Host Configuration Protocol. It is a network management protocol that's used by servers to automatically assign IP addresses to the computers and devices connected to them.
On local area networks (LANs), such as those in your home or small and medium-sized offices, the servers that provide DHCP are usually run by routers. In large networks, such as those maintained by big companies or government institutions, DHCP can be provided by dedicated servers (specialized computers) instead of simple routers.
Besides IP addresses, DHCP can also be used to automatically assign the subnet mask, default gateway, and DNS servers to the computers and devices inside a given network.
How does DHCP work?
To understand how DHCP works, you must first understand the basics of what IP addresses are. Put simply, IP addresses are unique identifiers of the computers and other devices that are connected to a network. The PCs and other devices (printers, smartphones, etc.) in a network need IP addresses in order to be able to communicate between them, to send and receive data to other devices on the same network or on the internet. IP addresses are for computer networks what street addresses are for towns. You need them to be able to send messages around, to know where they are sent and where they start.
Every computer and device in a network needs a valid IP address to be reachable, and there are two ways in which a computer or device can get one. Computers and devices can use static or dynamic IP addresses. Static IP addresses are not assigned by servers or routers. Instead, they are manually configured by you or by your network's administrator.
Dynamic IP addresses, on the other hand, are not assigned manually, hence their name. They are assigned dynamically, or automatically if you prefer. Who or what assigns them? The answer is DHCP, the Dynamic Host Configuration Protocol.
When a computer or device in a network wants to connect to others and communicate with them, either locally or on the internet, there are a few things that take place in a matter of moments:
- The computer or device that wants to connect to the network/internet asks its server or router for an IP address. The message that's sent by the host computer or device is called a DHCP discovery request.
- When the server/router receives the request, it relays the demand to its DHCP network service. The DHCP service on the server/router looks into the available IP addresses that have not been claimed by other computers and devices. As soon as the DHCP server/router identifies a free IP address, it sends it to the computer or device that requested it. This part of the process is called a DHCP offer.
- The PC/device receives the dynamically allocated IP address and sends a message back to the DHCP server/router, acknowledging that it wants to use that IP address. This step is called a DHCP request message because the host actually requests the offered IP address.
- When the DHCP server/router receives the request message, it sends a final message to the computer or device that initiated this entire process. This message is called DHCP acknowledgment and contains all the other configuration information needed to grant network/internet access to the computer or device, such as the gateway and DNS servers.
- Finally, the DHCP server/router marks the designated IP address as being occupied and in use by the computer or device that requested it, which now can communicate with the other devices on the local network and access the internet if it's available.
What is the DHCP lease time?
Now you know how DHCP assigns IP addresses automatically to computers and devices. However, the IP addresses received from the DHCP server are not permanent, as you might be tempted to think. The IP addresses pool is limited, meaning that there are just so many of them available in a network.
Furthermore, some of the computers and devices connected might not stay on permanently or might not connect to the same network all the time. That means that, if their dynamically allocated IP addresses were permanent, they would occupy them even when they no longer need them. As such, DHCP assigns IP addresses only temporarily for a limited amount of time. That time is called DHCP lease time, and you can learn more about it from this article: How to change the DHCP lease time in Windows 10.
In conclusion, DHCP lease time is a feature that allows DHCP servers to reclaim unused IP addresses after a specified period of time passes.
Who invented DHCP?
Although you know now why DHCP was invented and what it's used for, you might also be wondering about how DHCP came to life and who invented it. Its history starts back in 1984, when the Internet Engineering Task Force (IETF), which is the internet's standards authority, created a network protocol called Reverse Address Resolution Protocol (RARP). RARP allowed computers without disk drives (called diskless workstations - they booted by loading an operating system directly from a central server) to automatically receive IP addresses.
However, RARP was difficult to implement and configure, so it was soon improved (in 1985) into another network protocol called BOOTP (Bootstrap Protocol). BOOTP servers could automatically assign IP addresses on more than one subnet.
DHCP was born out of BOOTP but was also able to dynamically assign IP addresses from a specified range, as well as reclaim them when no longer used (DHCP lease time), and provide other configuration options to network computers and devices such as the IP addresses of the gateway or the DNS servers. DHCP was standardized in 1993, and it continued to receive improvements since then.
Do you have any other questions about DHCP?
Now you know what DHCP means and what DHCP does. Isn't it a small wonder of the computer world and networking? Do you have other questions regarding DHCP? If you do, or if you have something to add to our article, feel free to leave a comment below.