標籤:des c style blog a http
動態主機設定協議(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.