动态主机设置协议(Dynamic Host Configuration Protocol, DHCP)是一个局域网的网络协议,使用UDP协议工作,主要有两个用途:

  • 给内部网络或网络服务供应商自动分配IP地址给用户
  • 给内部网络管理员作为对所有计算机作中央管理的手段

DHCP使用了租约的概念,或称为计算机IP地址的有效期。租用时间是不定的,主要取决于用户在某地联接Internet需要多久,这对于教育行业和其它用户频繁改变的环境是很实用的。通过较短的租期,DHCP能够在一个计算机比可用IP地址多的环境中动态地重新配置网络。DHCP支持为计算机分配静态地址,如需要永久性IP地址的Web服务器。

When a computer or other networked device connects to a network, its DHCP client software in the operating system sends a broadcast query requesting necessary information. Any DHCP server on the network may service the request. The DHCP server manages a pool of IP addresses and information about client configuration parameters such as default gateway, domain name, the name servers, and time servers. On receiving a request, the server may respond with specific information for each client, as previously configured by an administrator, or with a specific address and any other information valid for the entire network, and the time period for which the allocation (lease) is valid.

The client broadcasts messages on the network subnet using the destination address 255.255.255.255 or the specific subnet broadcast address. A DHCP client may also request its last-known IP address. If the client remains connected to the same network, the server may grant the request. Otherwise, it depends whether the server is set up as authoritative or not. An authoritative server denies the request, causing the client issue a new request. A non-authoritative server simply ignores the request, leading to an implementation-dependent timeout for the client expire the request and ask for a new IP address.

When a DHCP server receives a DHCPDISCOVER message from a client, which is an IP address lease request, the server reserves an IP address for the client and makes a lease offer by sending a DHCPOFFER message to the client. This message contains the client's MAC address, the IP address that the server is offering, the subnet mask, the lease duration, and the IP address of the DHCP server making the offer.

In response to the DHCP offer, the client replies with a DHCP request, broadcast to the server, requesting the offered address. A client can receive DHCP offers from multiple servers, but it will accept only one DHCP offer. Based on required server identification option in the request and broadcast messaging, servers are informed whose offer the client has accepted.[5] When other DHCP servers receive this message, they withdraw any offers that they might have made to the client and return the offered address to the pool of available addresses.

When the DHCP server receives the DHCPREQUEST message from the client, the configuration process enters its final phase. The acknowledgement phase involves sending a DHCPACK packet to the client. This packet includes the lease duration and any other configuration information that the client might have requested. At this point, the IP configuration process is completed.

After the client obtains an IP address, the client may use the Address Resolution Protocol (ARP) to prevent address conflicts caused by overlapping address pools of DHCP servers.

最新文章

  1. FreeMarker:怎么使用
  2. 【总结】/etc/rc.d/rc.local 与 /etc/profile .bash_profile .bashrc 文件执行顺序
  3. Java控件(日常笔记)
  4. python多线程的用法之一
  5. php课程---练习连接数据库及增删改
  6. nand flash 扇区的管理以及初始化
  7. android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
  8. js 冒泡事件的处理
  9. Ubuntu ROS Arduino Gazebo学习镜像iso说明(indigo版)
  10. IIS与ASP.NET对请求的处理
  11. SD详解-销售过程
  12. delphi连接mysql (通过libmysql.dll连接)
  13. tcpdump过滤某个端口
  14. burpsuite扩展集成sqlmap插件
  15. iOS 处理cell选中时背景颜色消息问题
  16. (最小生成树) Jungle Roads -- POJ -- 1251
  17. bzoj 3672 利用点分治将CDQ分治推广到树型结构上
  18. Web.config配置configSections学习
  19. Eclipse Spring Tool Suite插件安装
  20. vue数据绑定html

热门文章

  1. Find a way HDU - 2612(bfs)
  2. Linux学习-Linux的账号与群组
  3. Python之PyFrameObject动态执行环境
  4. c#利用反射实现对类中的常量进行取值和对应常量的注释
  5. Eclipse下创建Spring MVC web程序--maven版
  6. 大数据学习——kettle的简单使用
  7. ptyhon - 接口自动化测试实战case1
  8. classpath路径
  9. 如何使用Python的logging模块
  10. localStorage的用法