Friday, January 27, 2012

Dynamic Host Configuration Protocol (DHCP)


Dynamic Host Configuration Protocol (DHCP) is a network configuration protocol for hosts on Internet Protocol (IP) networks. Computers that are connected to IP networks must be configured before they can communicate with other hosts. The most essential information needed is an IP address, and a default route and routing prefix. DHCP eliminates the manual task by a network administrator. It also provides a central database of devices that are connected to the network and eliminates duplicate resource assignments.
In addition to IP addresses, DHCP also provides other configuration information, particularly the IP addresses of local caching DNS resolvers, network boot servers, or other service hosts.
 

What is DHCP?


The Domain Name System, more popular as DNS, and the Dynamic Host Configuration Protocol, also known as DHCP, represent two crucial TCP/IP areas of a Windows NT Server network. The DNS is responsible for converting hostnames into IP addresses, while the DHCP is engaged in assigning unique dynamic IP addresses and the corresponding subnet masks and default gateways to TCP/IP running computers within a particular server network.
Why would you need to use the DHCP? Thanks to the dynamic addressing executed by the DHCP, a computer can have a different IP address every time it connects to the network it belongs to, without the intervention of a UNIX administrator. Through this DHCP functionality every new computer added to a network is automatically assigned a unique IP address.
DHCP servers greatly simplify the configuration of networks and are built in the majority of the wireless access points and wired Ethernet routers. 

How does the DHCP work?


In a network, a DHCP server manages a pool of IP addresses, as well as default gateway details, DNS details and other information for the clients’ network configuration. When a new computer is introduced into a DHCP server-enabled network, it will send a query to the DHCP server requesting all the necessary information. When the query reaches the DHCP server, it will grant the new computer a new IP address and a lease - a time frame for which the computer can use this IP address, as well as other configuration details. The whole process takes place immediately after the new computer boots, and to be successful, it has to be completed before initiating IP based communication with other hosts in the network. 

DHCP allocation methods


Depending on its configuration, the DHCP server can work in 3 ways: 

1.     Dynamic allocation


When the DHCP server is configured to use dynamic allocation, this means that it uses a lease policy. This way, when an assigned IP address from the available pool is no longer used, it will be transferred back to the pool, making it available for someone else to use. The advantage of this method is that the IP addresses are used to their maximum - as soon as they are no longer used by the client, they are instantly made available to others. The disadvantage of this method is that a client will always have a random IP address. 

2.     Automatic allocation


The automatic allocation method resembles very much the dynamic allocation method - as soon as a client connects, the DHCP server provides him with an IP address from the IP address pool. However, when automatic allocation is used, the DHCP server keeps a database of previous IP grants, and tries to give the client the same IP address he used the last time, if available. 

3.     Static allocation


The static allocation method is very popular in modern ISP networks, which do not use dial-up methods. With the static allocation, the DHCP sever keeps a database with all clients' LAN MAC addresses and gives them an IP address only if their MAC address is in the database. This way, the clients can be sure that they will be getting the same IP address every time. 
A DHCP server can be set to work using a combination of the allocation methods. For example, in a public WiFi network, all of the known hosts and permanent clients can use the static allocation, whereas for guests, the dynamic allocation is used. This way, known hosts can always use the same IP address and the IP address pool is equally available to everyone. 

DHCP Lease Renewal

After 50% of the lease time has passed, the client will attempt to renew the lease with the original DHCP server that it obtained the lease from using a DHCPREQUEST message. Any time the client boots and the lease is 50% or more passed, the client will attempt to renew the lease. At 87.5% of the lease completion, the client will attempt to contact any DHCP server for a new lease. If the lease expires, the client will send a request as in the initial boot when the client had no IP address. If this fails, the client TCP/IP stack will cease functioning.

DHCP Scope and Subnets

One DHCP scope is required for each subnet. 
DHCP Relay Agents

May be placed in two places:

·         Routers

·         Subnets that don't have a DHCP server to forward DHCP requests.

Since DHCP clients request IP addresses via broadcast messages, the DHCP server and clients must be on the same subnet. Therefore, a DHCP server must be available on each subnet. It is not practical.

DHCP relay agent solves the problem. Via a relay agent, DHCP clients communicate with a DHCP server on another subnet to obtain configuration parameters. Thus, DHCP clients on different subnets can contact the same DHCP server for ease of centralized management and cost reduction.
DHCP relay agent application













No matter whether a relay agent exists or not, the DHCP server and client interact with each other in a similar. The following describes the forwarding process on the DHCP relay agent.
DHCP relay agent work process









As shown in the figure above, the DHCP relay agent works as follows:

1) After receiving a DHCP-DISCOVER or DHCP-REQUEST broadcast message from a DHCP client, the DHCP relay agent fills the giaddr field of the message with its IP address and forwards the message to the designated DHCP server in unicast mode.

2) The DHCP server returns an IP address and other configuration parameters to the relay agent, which conveys them to the client.


Client Reservation

Client Reservation is used to be sure a computer gets the same IP address all the time. Therefore since DHCP IP address assignments use MAC addresses to control assignments, the following are required for client reservation:

·         MAC (hardware) address

·         IP address

Exclusion Range

Exclusion range is used to reserve a bank of IP addresses so computers with static IP addresses, such as servers may use the assigned addresses in this range. These addresses are not assigned by the DHCP server.


0 nhận xét:

Post a Comment