DHCP server installation and configuration Linux
DHCP server : Dynamic host configuration protocol is a Client/Server protocol which will automatically provide IP address to the requested client. Not only IP address along with IP it will also provide subnet mask, default gateway and DNS IP address.
Every device on a TCP/IP-based network must have a unique unicast IP address to access the network and its resources. Without DHCP, IP addresses for new computers or computers that are moved from one subnet to another must be configured manually; IP addresses for computers that are removed from the network must be manually reclaimed.
With DHCP, this entire process is automated and managed centrally. The DHCP server maintains a pool of IP addresses and leases an address to any DHCP-enabled client when it starts up on the network. Because the IP addresses are dynamic (leased) rather than static (permanently assigned), addresses no longer in use are automatically returned to the pool for reallocation.
With DHCP, this entire process is automated and managed centrally. The DHCP server maintains a pool of IP addresses and leases an address to any DHCP-enabled client when it starts up on the network. Because the IP addresses are dynamic (leased) rather than static (permanently assigned), addresses no longer in use are automatically returned to the pool for reallocation.
DHCP server will provide a automatic IP address using DORA process which means
DHCP discovery
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.
DHCP offer
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.DHCP request
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. 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.DHCP acknowledgement
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.
while providing the permanent IP address to the DHCP client it will collect its MAC address. Provided IP address will not changed until DHCP server lease time expires.
::DHCP Server Profile::
Packages : dhcp*
Service : dhcpd.service
Config file : /etc/dhcp/dhcpd.conf
Port Number: 67
Installing DHCP server required packages using yum
you may receive above error some times don’t worry after we set and DHCP server configuration restart service will work normally
Copy the sample configuration file to main configuration file. Default DHCP server configuration will not contain anything (empty)
Now edit the config file /etc/dhcp/dhcpd.conf
as shown in above we have to change subnet IP netmask IP add your domain name, routers IP (default gateway) broadcast IP address.
After that restart the dhcpd service
dhcp server configuration verification we can verify the config file using below command, will tell you where is the configuration went wrong
that’s for server side.
Go to client and test whether your getting same series IP address.
Stay tune for mac binding / reserving static IP to particular server
####################################################3
Configuring MAC binding in DHCP Server
configuring MAC binding in DHCP server means permanently assigning static Internet protocol (IP) to the DHCP client using client MAC address.
We don’t want to give automatic IP address to servers, which are service providers. As a example if a NFS or Samba Server IP got changed automatically after a reboot are Network restart then all client who are acessing NFS and Samba shares can’t be accessible using old IP address each and every time we have to intimate to the employees if server IP address changed. Not only about accessing the NFS and Samba shares some of the shares maybe used for hosting of application. Hot coded links in HTML/PHP intranets all things get effected due an single IP address change.
Our goal is to set static IP address to DHCP client (server) using DHCP server configuration, which is called asconfiguring MAC binding
first step is to configure DHCP server, please refer below link
DHCP server installation and configuration Step by Step Guide
Configuring MAC binding
after configuring the DHCP server restart the service and verify status
collect client machine MAC address simple trick, ping to all the clients which you want configure MAC binding then run # arp -a command
Edit the configuration and change as required
as shown above we have to add host short name MAC address and host IP address.
If you want to configure MAC binding for 50 servers then copy the same line and paste below 50 times and change there MAC address, hostname and IP address accordingly.
test configuration file before restarting DHCP server
restart DHCP service
That’s it restart network services in client and verify specified IP address it will get. If you restart 100 times also you will get same IP address from DHCP lease.
No comments:
Post a Comment