DHCP(Dynamic Host Configuration Protocol, Dynamic Host Configuration Protocol ) It's a LAN Of Network protocol , Use UDP Agreement work , There are two main uses : To the internal network or Network services Suppliers are automatically assigned IP Address , To users or internal network administrator As for all Computer do The means of central management , stay RFC 2131 Detailed description in .DHCP Yes 3 Ports , among UDP67 and UDP68 For the normal DHCP Service port , Respectively as DHCP Server and DHCP Client Service port for ;546 Port number is used for DHCPv6 Client, Not for DHCPv4, Is for DHCP failover service , This is a service that needs to be opened specially ,DHCP failover Is used to do “ hot standby ” Of .

  • Chinese name : Dynamic Host Configuration Protocol
  • Foreign name :Dynamic Host Configuration Protocol
  • class      type : Computer network application layer protocol
  • Jane      call :DHCP

    Function Overview

  • DHCP(Dynamic Host Configuration Protocol, Dynamic Host Configuration Protocol ) It is usually used in large local area network environment , The main function is centralized management 、 Distribute IP Address , Make the host in the network environment dynamically obtain IP Address 、 Gateway Address 、DNS Server address and other information , And can improve the usage rate of address .DHCP The protocol adopts client / Server model , The dynamic assignment task of the host address is driven by the network host . When DHCP When the server receives the information from the network host application address , Will send the related address configuration and other information to the network host , To realize the dynamic configuration of network host address information .DHCP Has the following functions :
  • 1. Guarantee any IP The address can only be set by one DHCP Used by the client .
    2. DHCP It should be possible to assign permanent IP Address .
    3. DHCP Should be available in the same way as in other ways IP Address of the host coexistence ( Such as manual configuration IP Address of the host ).
    4. DHCP The server We should pay attention to the existing BOOTP client Provide services .
    DHCP There are three mechanisms for distribution IP Address :
    1) Automatic allocation method (Automatic Allocation),DHCP The server specifies a permanent IP Address , once DHCP The first successful client from DHCP Server side lease to IP After the address , You can use the address permanently .

    Related pictures
    2) Dynamic distribution mode (Dynamic Allocation),DHCP The server specifies a time limited IP Address , When the time expires or the host explicitly gives up the address , This address can be used by other hosts .
    3) Manual allocation method (Manual Allocation), Client's IP The address is specified by the network administrator ,DHCP The server will only specify IP Address to client host .
    Of the three ways of address assignment , Only dynamic allocation can reuse addresses that clients no longer need .

    DHCP The format of the message is based on BOOTP(Bootstrap Protocol) Message format , This requires the device to have BOOTP The function of relay agent , And be able to communicate with BOOTP Client and DHCP The server implements interaction .BOOTP The function of relay agent can , This makes it unnecessary to deploy one in every physical network DHCP The server .RFC 951 and RFC 1542 Yes BOOTP The protocol is described in detail

Related introduction

DHCP client

In support of DHCP The specified port will be used as DHCP Client, adopt DHCP The agreement is from DHCP Server Get dynamic IP Address and other information , To realize the centralized management of equipment . It is generally applied to the network management interface of network equipment .
DHCP The client can bring the following benefits :
  • Reduced time to configure and deploy devices .
  • Reduces the possibility of configuration errors .
  • Can centralize the management of equipment IP Address assignment

DHCP The server

DHCP Server refers to the server that is created by The server Control for a while IP Address range , When the client logs in to the server, it can automatically get the information assigned by the server IP Address and Subnet mask .

DHCP Relay agent

DHCPRelay(DHCPR)DHCP relay It's also called DHCP Relay agent .DHCP Relay agent , Is in the DHCP Servers and clients

Related pictures

Forward between DHCP Data packets . When DHCP The client is not on the same subnet as the server , There must be DHCP Relay agent to forward DHCP Request and reply messages .DHCP relay Proxy data forwarding , It's different from routing and forwarding , Generally, routing and forwarding are relatively transparent , The equipment will not be modified IP Package content . and DHCP The relay agent received DHCP After the news , Regenerate a DHCP news , Then forward it .

stay DHCP The client looks like ,DHCP The relay agent is like DHCP The server ; stay DHCP The server looks like ,DHCP The relay agent is like DHCP client .

working principle

DHCP The agreement adopts UDP As a transport protocol , The host sends a request message to DHCP Server's 67 Port no. ,DHCP The server responds to the message sent to the host 68 Port no. . The detailed interaction process is as follows .

  1. DHCP Client Send out by radio DHCP Discover message .
  2. be-all DHCP Server Can receive DHCP Client Sent DHCP Discover message , be-all DHCP Server Will give a response , towards DHCP Client Send a DHCP Offer message .
    DHCP Offer In the message “Your(Client) IP Address” The field is DHCP Server Be able to provide to DHCP Client The use of IP Address , And DHCP Server I will take my own IP The address is in “option” Field so that DHCP Client Distinguish between different DHCP Server.DHCP Server After sending this message, there will be an allocated IP A record of the address .
  3. DHCP Client Only one of them DHCP Offer message , The general principle is DHCP Client Process the first received DHCP Offer message .
    DHCP Client There will be a broadcast DHCP Request message , The selected... Will be added to the options field DHCP Server Of IP Address and need IP Address .
  4. DHCP Server received DHCP Request After the message , Determine... In the options field IP Is the address the same as your own . If it's not the same ,DHCP Server Do nothing but clear the corresponding IP Address assignment records ; If the same ,DHCP Server Will go to DHCP Client In response to a DHCP ACK message , And add... In the options field IP Address usage lease information .
  5. DHCP Client Received DHCP ACK After the message , Check DHCP Server The distribution of IP Whether the address can be used . If you can use , be DHCP Client To succeed in IP Address and according to IP The address uses the lease term to automatically start the renewal process ; If DHCP Client Find the assigned IP Address is already in use , be DHCP Client towards DHCPServer issue DHCP Decline message , notice DHCP Server Disable this IP Address , then DHCP Client Start the new address application process .
  6. DHCP Client In the successful acquisition of IP After the address , You can always send DHCP Release The message releases its own IP Address ,DHCP Server received DHCP Release After the message , It will be recycled IP Address and reassign .
The lease term in use exceeds 50% At the moment ,DHCP Client Will be unicast to DHCP Server send out DHCPRequest Message to renew IP Address . If DHCP Client Successfully received DHCP Server Sent DHCP ACK message , Then extend... According to the corresponding time IP Address lease ; If not received DHCP Server Sent DHCP ACK message , be DHCP Client Keep using this IP Address .
The lease term in use exceeds 87.5% At the moment ,DHCP Client Will broadcast to DHCP Server send out DHCPRequest Message to renew IP Address . If DHCP Client Successfully received DHCP Server Sent DHCP ACK message , Then extend... According to the corresponding time IP Address lease ; If not received DHCP Server Sent DHCP ACK message , be DHCP Client Keep using this IP Address , until IP At the expiration of the term of use of the address ,DHCP Client To DHCP Server send out DHCP Release Message to release this IP Address , And start a new IP Address application process .
It should be noted that :DHCP The client can receive multiple DHCP Server's DHCPOFFER Data packets , And then it's possible to accept either DHCPOFFER Data packets , But clients usually only accept the first one they receive DHCPOFFER Data packets . in addition ,DHCP The server DHCPOFFER It is specified in [1]  The address of is not necessarily the final assigned address , Usually ,DHCP The server keeps the address until the client makes a formal request .
Formal request DHCP Server assigned address DHCPREQUEST Using broadcast packets , It's for all the others to send DHCPOFFER Packet DHCP The server can also receive the packet , And then release what has been OFFER( Pre allocation ) For the client IP Address .
If sent to DHCP The client's address has been changed by other DHCP Client side usage , The client will send... To the server DHCPDECLINE The packet refused to accept the assigned address information .
In the process of negotiation , If DHCP Sent by the client REQUEST The address information in the message is incorrect , For example, the client has migrated to a new subnet or the lease has expired ,DHCP The server will send DHCPNAK A message to DHCP Customer End , Let the client restart the address request process .

DHCP usage

When is the best time to use DHCP ?
There's a lot inside the company Laptop Computer Occasion of use ! because Laptop On the use , When set to DHCP client When , So as long as it is connected to the domain, there is one that can access the Internet DHCP The server , The department of Laptop So you can connect Internet 了 !
In domain Computer Quite a lot of time : Another case is when the number of computers in the domain is quite large , You can't set their own network parameters one by one , This time to save trouble , Or set up DHCP It's convenient to come here .
Under what circumstances is it not recommended to use DHCP host ?
Client When the machine is turned on, it will send messages to all the machines in the domain , This is the time , If the domain is not DHCP host Well ? So this one Client End Computer Four requests will be sent , The first waiting time is 1 second , The remaining three waiting times are 9、13、16 second . If there is still no DHCP Response from the server , So in 5 Minutes later ,Client The end computer will repeat this action .
In the domain Computer , There are a lot of machines that actually do host Use of , Very few Client demand , Then there seems to be no need to set up DHCP.
source : Baidu Encyclopedia

DHCP More related articles in detail

  1. [DHCP service ]——DHCP Detailed explanation

    DHCP:(Dynamic Host Configuration Protocol) Dynamic Host Configuration Protocol 1. DHCP Is a LAN network protocol , use UDP Agreement work 2. DHCP effect (1) It's mainly used in big ...

  2. 【TCP/IP Detailed explanation Volume one : agreement 】 Chapter six :DHCP And automatic configuration

    brief introduction In order to use TCP/IP Protocol family , Every mainframe or Routers need certain configuration information : IP Address Subnet mask Broadcast address Routing or forwarding table DNS Protocol configuration method : Manual Get... By using web services Use some algorithms to automatically determine ...

  3. Protocol analysis - DHCP Protocol decoding details

    Protocol analysis  - DHCP Protocol decoding details [DHCP Protocol Brief ]         DHCP, The full name is  Dynamic Host Configuration Protocol﹐ The Chinese name is dynamic host configuration protocol , Its predecessor is ...

  4. 【 turn 】DHCP protocol

    Protocol analysis - DHCP Protocol decoding details DHCP Protocol Brief DHCP, The full name is  Dynamic Host Configuration Protocol﹐ The Chinese name is dynamic host configuration protocol , Its predecessor is  BOOTP, It works ...

  5. udhcp Source details ( 5、 ... and ) And DHCP package --options Field

    There was no update for a long time udhcp Source detailed explanation of the blog , The main reason is that there are too many functions in the source code , I don't know if I want to go on one by one , You know what to say DHCP The realization theory of the word, a blog can be roughly said , But the implementation of the source code has to be concerned about a lot of issues , for instance ...

  6. 【 introduction 】 Radio and television industry DNS、DHCP Solution details ( 3、 ... and )——DNS Deployment architecture and case

    [ introduction ] Radio and television industry DNS.DHCP Solution details ( 3、 ... and )——DNS Deployment architecture and case DNS System deployment architecture Broadband services DNS framework Interactive business DNS framework Case introduction Case a Case 2 In this article we will introduce DNS System deployment architecture , ...

  7. linux View ports and port details

    Today, I checked on the spot TCP Port usage , Here's the picture   The red part is IP, The scene asked me if my program was occupied tcp Link to ,, I remotely logged in and checked , This type of tcp Links take up 400 Multiple ,, Later, I checked the information , say E ...

  8. [ turn ] Alibaba database connection pool druid Configuration details

    One . background java A large part of the program operates on the database , In order to improve performance, when operating the database , You have to use the database connection pool . There are many options for database connection pooling ,c3p.dhcp.proxool etc. ,druid As a rising star , With its brilliance ...

  9. DOS Detailed command

    DOS Detailed command command \? You can go to command help Command create directory . MKDIR [drive:]pathMD [drive:]path If command extension is enabled ,MKDIR Will change as follows : if necessary ,MKD ...

Random recommendation

  1. Jenkins Advanced series of ——18Jenkins Language localization

    stay Jenkins in , A lot of English , Watching all kinds of eggs hurt . I'm very glad that ,Jenkins As a mainstream and popular continuous building tool , Provides a local language configuration interface . You can find it , stay Jenkins The bottom left corner of each page . Here's the picture : Click Help ...

  2. Node.js Advanced programming reading notes - 3 Network programming

    Outline 3.4 structure TCP The server 3.5 structure HTTP The server 3.6 structure TCP client 3.7 establish HTTP request 3.8 Use UDP 3.9 use TLS/SSL Ensure the security of the server 3.10 use H ...

  3. SAP Connect HANA database

    Since it's all used HANA 了 , Why is it still in SAP End , Connect HANA database , Do database processing ..... because HANA database , No users are STADIO Database tables built on ... Only this user can use , And do Universe When designing , ...

  4. ( turn )C# MD5

    The original address of this article : author : Zhou Gong The code is as follows : using System; using System. ...

  5. Recommended information —— Most recommended by netizens 30 Share HTML Front end development materials

    w3cmark A new column will be added recently , Focus on collecting front-end resources to download , Including e-books related to the front end . file PPT. manual . Video tutorials and so on . The media for downloading is the micro disk of microblog , As for why choose micro disk , That's because it's associated with microblogging , Through the micro disk ...

  6. Yii Install the QR code extension Qrcode

    For example, to add Generating a QR code The first way to extend this :    1. Open the root composer.json, stay re ...

  7. [hdu5608]function

    The question :$\sum_{d|n}f(d)=n^{2}-3n+2$, seek $\sum_{i=1}^{n}f(i)\mod 10^{9}+7$ , $n \leqslant 10^{9}$ $\left( T \ ...

  8. Installshield There are several reasons why creating shortcuts doesn't work

    Installshield The software provides the function of creating shortcut , However, some friends often find that the shortcut cannot run after it is created , Here are some common reasons for your reference : 1. I didn't choose the corresponding working directory, such ...

  9. 【cf842D】Vitya and Strange Lesson(01 Dictionary tree )

    D. Vitya and Strange Lesson The question There are... In the sequence n Number ,m operations , Every time I give x, Give Way n All the numbers are different x. And output the sequence of mex value . Answer key 01 The dictionary tree holds several numbers under each node , Then the current total XOR ...

  10. JavaScirpt Object native methods

    Object.assign() Object.assign() Method is used to merge objects , Only enumerable properties are merged const obj1= {a: 1} const obj2 = Object.assign({}, ...