In below article you will learn about what is DHCP server and how it’s work.
- DHCP definition.
- DHCP simplifies IP address management.
- Components of DHCP.
- 8 DHCP messages for connection.
- Benefits of DHCP servers.
- DHCP poses security risks.
- Advantages & Disadvantages.
It is a network protocol that used on IP networks where a DHCP server automatically assigns an IP address and other information to each host which are connected on network .so they can communicate efficiently with other endpoints.
DHCP is dynamic host configuration protocol.
In addition for IP address, DHCP also assigns the subnet mask, default gateway IP and domain name server (DNS) address and other pertinent config parameters. (RFC) 2131 and 2132 explain DHCP as an Internet Engineering Task Force (IETF)- its standard based on the BOOTP protocol.
DHCP server simplifies IP address management.
The primary needed of DHCP is to simplify the management of IP addresses on networks. while two hosts can have the same IP address, and configuring them manually will likely get conflict errors. In small networks assigning manually IP addresses is little confusing, particularly with mobile devices that require IP addresses on a non-permanent basis. Also, most users are not technically sound enough to locate the IP address information on there computer and assign it. Automating this process makes easier for users and for network administrator.
Components of DHCP server
- This is a list of the components in DHCP:-
- DHCP server
- DHCP client
- IP address pool
- DHCP relay
Components of DHCP in Details
DHCP server: Any networked device that has running the DCHP service and can holds IP addresses and related configuration information. There are most typically a server or a router but could be any that can acts as a host such as an SD-WAN appliance.
DHCP client: The endpoint device which receives configuration information from a DHCP server. It can be a computer, mobile device, IoT device or anything else that requires connectivity to the network. Most are configured and capable to receive DHCP information by default.
IP address pool: It’s range of addresses that are available to DHCP clients. Addresses are typically sequentially from lowest to highest.
Subnet: IP networks can be partitioned into segments known as subnets. Subnets keep networks manageable
Lease: Total length of time for which a DHCP client holds the IP address information. When a lease time expires after that client must renew it.
DHCP relay: A router that listens client messages being broadcast on that network and then forwards them to a configured server. The server then sends responses back to the relay agent than passes them along to the client. This can be used with centralize DHCP servers instead of having a server on each subnet.
8 DHCP messages for connection
- The message list is as given below:-
- DHCP discover message
- DHCP offer message
- DHCP request message
- DHCP acknowledgement message
- DHCP negative acknowledgement message
- DHCP decline
- DHCP release
- DHCP inform
Note – All the messages can be unicast also by dhcp relay agent if the server is present in different network.
DHCP discover message :-It’s first message generated during communication process between server and client.message is generated by Client in order to discover if there is any DHCP server is present in a network or not. A message is broadcasted to all devices present in a network to find the DHCP server. This message is 342 or 576 bytes long.
As shown in the figure, source MAC address (client PC) ####2B2EAF2A, destination MAC address(server MAC) is ###FFFFFFFFF source IP address is 0.0.0.0(because PC has no IP address till now) and destination IP address is 255.255.255.255 (used for broadcasting). when discover message is broadcast to find out the DHCP server or servers in the network therefore broadcast IP address and MAC address is used.
DHCP offer message:-server will respond to host in message specifying the unleased IP address and other TCP configuration information. This message is broadcasted by server. Size of message is 342 bytes. If there are more than one DHCP servers present in network then client will accept the first DHCP OFFER message it receives. Also a server ID specified for packet in order to identify the server.
Now for the offer message, source IP address is 172.16.32.12 (server’s IP address in the example), destination IP address is 255.255.255.255 (broadcast IP address) source MAC address is ##AA00123456, destination MAC address is ###FFFFFFFFF. offer message is broadcast by the DHCP server so destination IP address is broadcast IP address and destination MAC address is FFFFFFFFFFFF and the source IP address is server IP and MAC address is server MAC address.
A server has provided the offered IP address 188.8.131.52 and the lease time of 72 hours(after this time the entry of host will be erased from the server automatically) . Also the client identification is PC MAC address (#8002B2EAF2A) for all the messages.
DHCP request message:-When a client receives a offer message, it responds with broadcasting a DHCP with request message. A client will produce a gratitude ARP in order to find if there is any other host present in the network with same IP address. If there is no reply by other host, then there is no host with same TCP configuration in the network and the message broadcasted to server showing the acceptance of IP address .A Client ID will add in this message.
Now request message broadcast by the client PC therefore source IP address is 0.0.0.0(as the client has no IP right now) and destination IP address is 255.255.255.255 (broadcast IP address) and source MAC address is #8002B2EAF2A (PC MAC address) and destination MAC address is FFFFFFFFFFFF.
Note:-This message is broadcast after the ARP request broadcast by the PC to find out whether any other host is not using that offered IP. If there is no reply then the client host broadcast the DHCP with request message of the server showing the acceptance of IP address and Other TCP/IP Configuration.
DHCP acknowledgement message:- To response to the request message received the server will make an entry with specified client ID and bind same IP address offered with lease time. Now, the client will have the IP address provided assign by server.
Now the server will make an entry of the client host with the offered IP address and lease time. This IP address will not be provided by server to any other host. The destination MAC address is FFFFFFFFFFFF and the destination IP address is 255.255.255.255 and the source IP address is 172.16.32.12 and the source MAC address is 00AA00123456 (server MAC address).
DHCP negative acknowledgement message:– While a DHCP server receives a request for IP address which is not valid according to the scopes that is configured with it send DHCP Nak message to client. Eg-when the server has no IP address unused or the pool is empty, then this message is sent by the server to client.
DHCP decline :– If DHCP client determines the offered configuration parameters are different and not valid then it sends DHCP decline message to the server .When there is a reply to the gratitude ARP by any host to the client,.the client sends DHCP decline message to the server showing the offered IP address is already in use.
DHCP release :- DHCP client sends DHCP release packet to server for release IP address and cancel any remaining lease time.
DHCP inform:– If a client address has obtained IP address manually then the client uses a DHCP inform to obtain other local configuration parameters. such as domain name. In reply to the dhcp inform message, DHCP server will generates DHCP ack message with local configuration suitable for the client without allocating a new IP address. so DHCP ack message is unicast to the client.
Benefits of DHCP servers
Accurate configuration:– The IP address configuration parameters must be exact and when dealing with inputs such as “192.168.159.3”. it’s easy to make a mistake. Typographical mistake are typically very difficult to troubleshoot so the DHCP server minimizes that risk.
Reduced conflicts of IP address :-Each connected device must have unique IP address. However each address can only be used once and a duplicate address will result in a conflict where one or both devices cannot be connected. This can happen when addresses are assigned manually particularly when there is large number of endpoints that only connect periodically, such as mobile user.The use of DHCP ensures that each IP address is only used once.
Automation for administration:-Without DHCP network administrators have to assign and revoke addresses manually.Keeping track of which device and User has what address can be an exercise in futility as it’s nearly impossible to understand and rectify when devices require access to the network and when they are going to leave. DHCP sever allows this as automated and centralized so network professionals can manage all site locations from a single location.
Efficient during change management:-Using DHCP server makes it very simple to change addresses, scopes and endpoints. For example IF organization want to change its IP addressing scheme from one range to another.A DHCP server is configured with the new information and the information will be propagated to the new endpoints. Similarly with network device is upgraded and replaced, no network configuration is required.
DHCP poses security risks
1. The DHCP protocol requires no authentication because of that any client can join a network quickly. Because of this, it can opens up a number of security risks, including unauthorized servers handing out bad information to clients, unauthorized clients being given IP addresses and IP address depletion from unauthorized or malicious clients.
2.Since the client has no way of validating the authenticity of a DHCP server, rouge ones can be used to provide incorrect network information. This can cause denial-of-service attacks or man-in-the-middle attacks where a fake server intercepts data that can be used for malicious purposes. Conversely, because the DHCP server has no way of authenticating a client, it will hand out IP address information to any device that makes a request. A threat actor could configure a client to continually change its credentials and quickly exhaust all available IP addresses in the scope, preventing company endpoints from accessing the network.
3.so DHCP server specification does addresses some of these issues. There are Relay Agent Information Option that enables engineers to tag DHCP messages as they arrive on the network. This tag can be used to control access to the network. There is some provision to authenticate DHCP messages, but key management can be complicated and has held back adoption. Using 802.1x authentication, known as network access control (NAC). It can be used to secure DHCP.Most of the leading network vendors support NAC, and it has become significantly simpler to deploy.
Advantages of DHCP server
The advantages of using DHCP include:-
- Centralized management of IP addresses
- Ease of adding new clients to a network
- Reuse of IP addresses reducing total number of IP addresses that are required simple reconfiguration of the IP address space on the DHCP server without needing to reconfigure each client.
- The DHCP protocol gives the network administrator a method to configure the network from a centralized location.
- With the help of DHCP, easy handling of new users and reuse the IP address can be achieved.
- DHCP server can be single point of failure in networks having only one configured DHCP server
- Client is not able to access the network in the absence of the DHCP server.
- IP conflict could be occur.
Configuration steps for DHCP Server
Step1: Build the network topology.
Step2: Configure static IP address on the DHCP server. It is necessary because for client PC to request for an address from the server. it has to sent the request to a specific address, i.e, the IP address of DHCP server.
Step3: Now configure DHCP service on the generic server. To do this,click on the server, then click on Services tab. You will pick DHCP on the menu. First turn ON the DHCP service. Then proceed do define the DHCP network parameters as follows:
- Pool name
- Default Gateway
- DNS Server
- Start IP Address
- Subnet Mask
- Click on add then Save. The DHCP entry is included in the list.
Step4: Finally, enable DHCP configuration on each PC. The three PCs should get automatically configured.